authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-26 20:06:11-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-27 08:42:02+01:00
log0d25302d43557d89b868b8925b2e98395d1ebe60
treefdac48106d75cae799a834183e3471e48acd1ee6
parenta85495ca22e5410df00a59fe82fe480645ca3f85

Package.Fetch: bump redirect buffer size

RFC 9110 says > It is RECOMMENDED that all senders and recipients support, at a minimum, > URIs with lengths of 8000 octets in protocol elements. closes #30207

2 files changed, 4 insertions(+), 3 deletions(-)

lib/std/http/Client.zig+3-2
......@@ -1126,7 +1126,7 @@ pub const Request = struct {
11261126 /// `redirect_buffer` must outlive accesses to `Request.uri`. If this
11271127 /// buffer capacity would be exceeded, `error.HttpRedirectLocationOversize`
11281128 /// is returned instead. This buffer may be empty if no redirects are to be
1129 /// handled.
1129 /// handled. RFC 9110 recommends making this at least 8000 bytes.
11301130 ///
11311131 /// If this fails with `error.ReadFailed` then the `Connection.getReadError`
11321132 /// method of `r.connection` can be used to get more detailed information.
......@@ -1748,7 +1748,8 @@ pub fn request(
17481748}
17491749
17501750pub const FetchOptions = struct {
1751 /// `null` means it will be heap-allocated.
1751 /// `null` means it will be heap-allocated. RFC 9110 recommends at least
1752 /// 8000 bytes.
17521753 redirect_buffer: ?[]u8 = null,
17531754 /// `null` means it will be heap-allocated.
17541755 decompress_buffer: ?[]u8 = null,
src/Package/Fetch.zig+1-1
......@@ -1193,7 +1193,7 @@ fn initResource(f: *Fetch, uri: std.Uri, resource: *Resource, reader_buffer: []u
11931193 request.sendBodiless() catch |err|
11941194 return f.fail(f.location_tok, try eb.printString("HTTP request failed: {t}", .{err}));
11951195
1196 var redirect_buffer: [1024]u8 = undefined;
1196 var redirect_buffer: [8000]u8 = undefined;
11971197 const response = &resource.http_request.response;
11981198 response.* = request.receiveHead(&redirect_buffer) catch |err| switch (err) {
11991199 error.ReadFailed => {