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 {...@@ -462,7 +462,6 @@ pub const Response = struct {
462462
463 const first_line = it.next().?;463 const first_line = it.next().?;
464 if (first_line.len < 12) {464 if (first_line.len < 12) {
465 std.debug.print("first line: '{s}'\n", .{first_line});
466 return error.HttpHeadersInvalid;465 return error.HttpHeadersInvalid;
467 }466 }
468467
...@@ -1573,6 +1572,7 @@ pub const FetchOptions = struct {...@@ -1573,6 +1572,7 @@ pub const FetchOptions = struct {
1573 method: ?http.Method = null,1572 method: ?http.Method = null,
1574 payload: ?[]const u8 = null,1573 payload: ?[]const u8 = null,
1575 raw_uri: bool = false,1574 raw_uri: bool = false,
1575 keep_alive: bool = true,
15761576
1577 /// Standard headers that have default, but overridable, behavior.1577 /// Standard headers that have default, but overridable, behavior.
1578 headers: Request.Headers = .{},1578 headers: Request.Headers = .{},
...@@ -1622,6 +1622,7 @@ pub fn fetch(client: *Client, options: FetchOptions) !FetchResult {...@@ -1622,6 +1622,7 @@ pub fn fetch(client: *Client, options: FetchOptions) !FetchResult {
1622 .headers = options.headers,1622 .headers = options.headers,
1623 .extra_headers = options.extra_headers,1623 .extra_headers = options.extra_headers,
1624 .privileged_headers = options.privileged_headers,1624 .privileged_headers = options.privileged_headers,
1625 .keep_alive = options.keep_alive,
1625 });1626 });
1626 defer req.deinit();1627 defer req.deinit();
16271628