Commit 6b411f147c

Andrew Kelley <andrew@ziglang.org>
2025-08-07 04:01:22
std.http: address review comments
thank you everybody
1 parent 618a435
Changed files (3)
lib/std/http/Client.zig
@@ -115,8 +115,6 @@ pub const ConnectionPool = struct {
     /// Tries to release a connection back to the connection pool.
     /// If the connection is marked as closing, it will be closed instead.
     ///
-    /// `allocator` must be the same one used to create `connection`.
-    ///
     /// Threadsafe.
     pub fn release(pool: *ConnectionPool, connection: *Connection) void {
         pool.mutex.lock();
@@ -484,10 +482,8 @@ pub const Response = struct {
             };
             var it = mem.splitSequence(u8, bytes, "\r\n");
 
-            const first_line = it.next().?;
-            if (first_line.len < 12) {
-                return error.HttpHeadersInvalid;
-            }
+            const first_line = it.first();
+            if (first_line.len < 12) return error.HttpHeadersInvalid;
 
             const version: http.Version = switch (int64(first_line[0..8])) {
                 int64("HTTP/1.0") => .@"HTTP/1.0",
lib/std/http.zig
@@ -496,7 +496,7 @@ pub const Reader = struct {
                     return reader.in;
                 },
                 .deflate => {
-                    decompressor.* = .{ .flate = .init(reader.in, .raw, decompression_buffer) };
+                    decompressor.* = .{ .flate = .init(reader.in, .zlib, decompression_buffer) };
                     return &decompressor.flate.reader;
                 },
                 .gzip => {
@@ -730,7 +730,7 @@ pub const Decompressor = union(enum) {
                 return transfer_reader;
             },
             .deflate => {
-                decompressor.* = .{ .flate = .init(transfer_reader, .raw, buffer) };
+                decompressor.* = .{ .flate = .init(transfer_reader, .zlib, buffer) };
                 return &decompressor.flate.reader;
             },
             .gzip => {
lib/std/Uri.zig
@@ -377,7 +377,8 @@ pub fn parse(text: []const u8) ParseError!Uri {
 
 pub const ResolveInPlaceError = ParseError || error{NoSpaceLeft};
 
-/// Resolves a URI against a base URI, conforming to RFC 3986, Section 5.
+/// Resolves a URI against a base URI, conforming to
+/// [RFC 3986, Section 5](https://www.rfc-editor.org/rfc/rfc3986#section-5)
 ///
 /// Assumes new location is already copied to the beginning of `aux_buf.*`.
 /// Parses that new location as a URI, and then resolves the path in place.