authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-21 20:51:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-23 02:37:11-07:00
log40ed3c4d2493835cd0a9217b947b115780a9ff27
treeeeb8394c362b10f99adc47544fd6894b721cef5b
parentc0d8ac83eb0a8d80690db1691024fdda1668f364

std.http.Client: add keep_alive option to fetch


1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/http/Client.zig+2-1
......@@ -462,7 +462,6 @@ pub const Response = struct {
462462
463463 const first_line = it.next().?;
464464 if (first_line.len < 12) {
465 std.debug.print("first line: '{s}'\n", .{first_line});
466465 return error.HttpHeadersInvalid;
467466 }
468467
......@@ -1573,6 +1572,7 @@ pub const FetchOptions = struct {
15731572 method: ?http.Method = null,
15741573 payload: ?[]const u8 = null,
15751574 raw_uri: bool = false,
1575 keep_alive: bool = true,
15761576
15771577 /// Standard headers that have default, but overridable, behavior.
15781578 headers: Request.Headers = .{},
......@@ -1622,6 +1622,7 @@ pub fn fetch(client: *Client, options: FetchOptions) !FetchResult {
16221622 .headers = options.headers,
16231623 .extra_headers = options.extra_headers,
16241624 .privileged_headers = options.privileged_headers,
1625 .keep_alive = options.keep_alive,
16251626 });
16261627 defer req.deinit();
16271628