33 lines
631 B
Zig
33 lines
631 B
Zig
const std = @import("std");
|
|
const http = @import("./lib.zig");
|
|
|
|
const parser = @import("./request/parser.zig");
|
|
|
|
pub const Request = struct {
|
|
pub const Protocol = enum {
|
|
http_1_0,
|
|
http_1_1,
|
|
http_1_x,
|
|
};
|
|
|
|
protocol: Protocol,
|
|
|
|
method: http.Method,
|
|
uri: []const u8,
|
|
headers: http.Fields,
|
|
|
|
body: ?[]const u8 = null,
|
|
|
|
pub fn parse(alloc: std.mem.Allocator, reader: anytype) !Request {
|
|
return parser.parse(alloc, reader);
|
|
}
|
|
|
|
pub fn parseFree(self: *Request, alloc: std.mem.Allocator) void {
|
|
parser.parseFree(alloc, self);
|
|
}
|
|
};
|
|
|
|
test {
|
|
_ = parser;
|
|
}
|