authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-06 19:01:22-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-08-06 22:42:42-07:00
log59ba1973089c01554a5cefee1339fea773a3200a
treefc2bdf1db77bbe151cd88b0e7a2c8704c8e9d07e
parent995bfdf0ffb28cf2031b0b3ada53b2cb9275912f

std.http: address review comments

thank you everybody

3 files changed, 6 insertions(+), 9 deletions(-)

lib/std/Uri.zig+2-1
......@@ -377,7 +377,8 @@ pub fn parse(text: []const u8) ParseError!Uri {
377377
378378pub const ResolveInPlaceError = ParseError || error{NoSpaceLeft};
379379
380/// Resolves a URI against a base URI, conforming to RFC 3986, Section 5.
380/// Resolves a URI against a base URI, conforming to
381/// [RFC 3986, Section 5](https://www.rfc-editor.org/rfc/rfc3986#section-5)
381382///
382383/// Assumes new location is already copied to the beginning of `aux_buf.*`.
383384/// Parses that new location as a URI, and then resolves the path in place.
lib/std/http.zig+2-2
......@@ -496,7 +496,7 @@ pub const Reader = struct {
496496 return reader.in;
497497 },
498498 .deflate => {
499 decompressor.* = .{ .flate = .init(reader.in, .raw, decompression_buffer) };
499 decompressor.* = .{ .flate = .init(reader.in, .zlib, decompression_buffer) };
500500 return &decompressor.flate.reader;
501501 },
502502 .gzip => {
......@@ -730,7 +730,7 @@ pub const Decompressor = union(enum) {
730730 return transfer_reader;
731731 },
732732 .deflate => {
733 decompressor.* = .{ .flate = .init(transfer_reader, .raw, buffer) };
733 decompressor.* = .{ .flate = .init(transfer_reader, .zlib, buffer) };
734734 return &decompressor.flate.reader;
735735 },
736736 .gzip => {
lib/std/http/Client.zig+2-6
......@@ -115,8 +115,6 @@ pub const ConnectionPool = struct {
115115 /// Tries to release a connection back to the connection pool.
116116 /// If the connection is marked as closing, it will be closed instead.
117117 ///
118 /// `allocator` must be the same one used to create `connection`.
119 ///
120118 /// Threadsafe.
121119 pub fn release(pool: *ConnectionPool, connection: *Connection) void {
122120 pool.mutex.lock();
......@@ -484,10 +482,8 @@ pub const Response = struct {
484482 };
485483 var it = mem.splitSequence(u8, bytes, "\r\n");
486484
487 const first_line = it.next().?;
488 if (first_line.len < 12) {
489 return error.HttpHeadersInvalid;
490 }
485 const first_line = it.first();
486 if (first_line.len < 12) return error.HttpHeadersInvalid;
491487
492488 const version: http.Version = switch (int64(first_line[0..8])) {
493489 int64("HTTP/1.0") => .@"HTTP/1.0",