Skip to content

Commit

Permalink
fix(server): fix header_end index on parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mookums committed Nov 26, 2024
1 parent 87ea5d6 commit 608ccfe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion src/http/provision.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/http/server.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions src/http/stage.zig

This file was deleted.

0 comments on commit 608ccfe

Please sign in to comment.