http_headers_done_receiving

This commit is contained in:
sjorsdonkers
2025-08-13 14:29:23 +02:00
parent f6c68e4580
commit c0106a238b
5 changed files with 101 additions and 27 deletions

View File

@@ -244,8 +244,8 @@ pub const Headers = struct {
return list;
}
fn parseHeader(header_str: []const u8) ?struct { name: []const u8, value: []const u8 } {
const colon_pos = std.mem.indexOf(u8, header_str, ":") orelse return null;
pub fn parseHeader(header_str: []const u8) ?std.http.Header {
const colon_pos = std.mem.indexOfScalar(u8, header_str, ':') orelse return null;
const name = std.mem.trim(u8, header_str[0..colon_pos], " \t");
const value = std.mem.trim(u8, header_str[colon_pos + 1 ..], " \t");