diff --git a/src/http/provision.zig b/src/http/provision.zig index 69ab96f..67d9661 100644 --- a/src/http/provision.zig +++ b/src/http/provision.zig @@ -6,9 +6,13 @@ const Capture = @import("routing_trie.zig").Capture; const QueryMap = @import("routing_trie.zig").QueryMap; const Request = @import("request.zig").Request; const Response = @import("response.zig").Response; -const Stage = @import("stage.zig").Stage; const ServerConfig = @import("server.zig").ServerConfig; +pub const Stage = union(enum) { + header, + body: usize, +}; + pub const Provision = struct { index: usize, job: Job, diff --git a/src/http/server.zig b/src/http/server.zig index 5c0068a..9aaa32c 100644 --- a/src/http/server.zig +++ b/src/http/server.zig @@ -889,8 +889,10 @@ pub fn Server(comptime security: Security) type { } log.debug("{d} - parsing header", .{provision.index}); + // We add start to account for the fact that we are searching + // starting at the index of start. // The +4 is to account for the slice we match. - const header_end: u32 = @intCast(header_ends.? + 4); + const header_end: usize = header_ends.? + start + 4; provision.request.parse_headers(provision.recv_buffer.as_slice()[0..header_end], .{ .size_request_max = config.request_bytes_max, .size_request_uri_max = config.request_uri_bytes_max, diff --git a/src/http/stage.zig b/src/http/stage.zig deleted file mode 100644 index c5a7109..0000000 --- a/src/http/stage.zig +++ /dev/null @@ -1,4 +0,0 @@ -pub const Stage = union(enum) { - header, - body: u32, -};