mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
std.http: address review comments
thank you everybody
This commit is contained in:
parent
995bfdf0ff
commit
59ba197308
@ -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.
|
||||
|
||||
@ -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 => {
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user