fediglam/src/http/request.zig

33 lines
631 B
Zig
Raw Normal View History

const std = @import("std");
const http = @import("./lib.zig");
const parser = @import("./request/parser.zig");
pub const Request = struct {
2022-10-13 09:23:57 +00:00
pub const Protocol = enum {
http_1_0,
http_1_1,
2022-11-05 07:26:53 +00:00
http_1_x,
2022-10-13 09:23:57 +00:00
};
protocol: Protocol,
method: http.Method,
2022-10-13 09:23:57 +00:00
uri: []const u8,
2022-11-05 07:26:53 +00:00
headers: http.Fields,
body: ?[]const u8 = null,
2022-11-05 07:26:53 +00:00
pub fn parse(alloc: std.mem.Allocator, reader: anytype) !Request {
return parser.parse(alloc, reader);
2022-10-13 09:23:57 +00:00
}
2022-11-05 07:26:53 +00:00
pub fn parseFree(self: *Request, alloc: std.mem.Allocator) void {
2022-10-13 09:23:57 +00:00
parser.parseFree(alloc, self);
}
};
test {
_ = parser;
}