| author | |
| committer | |
| log | 61861ef3953a64a62868cde912e2ff56c2df441a |
| tree | a894047fe9aed29648ae70275cd4965fbd037720 |
| parent | 084a7cf0285a17b94ccf7822a4b3496d401e6cd8 |
2 files changed, 11 insertions(+), 11 deletions(-)
lib/std/http/Client.zig+6-6| ... | ... | @@ -521,7 +521,7 @@ pub const Response = struct { |
| 521 | 521 | |
| 522 | 522 | /// A HTTP request that has been sent. |
| 523 | 523 | /// |
| 524 | /// Order of operations: request -> start[ -> write -> finish] -> wait -> read | |
| 524 | /// Order of operations: open -> send[ -> write -> finish] -> wait -> read | |
| 525 | 525 | pub const Request = struct { |
| 526 | 526 | uri: Uri, |
| 527 | 527 | client: *Client, |
| ... | ... | @@ -754,7 +754,7 @@ pub const Request = struct { |
| 754 | 754 | /// If `handle_redirects` is true and the request has no payload, then this function will automatically follow |
| 755 | 755 | /// redirects. If a request payload is present, then this function will error with error.RedirectRequiresResend. |
| 756 | 756 | /// |
| 757 | /// Must be called after `start` and, if any data was written to the request body, then also after `finish`. | |
| 757 | /// Must be called after `send` and, if any data was written to the request body, then also after `finish`. | |
| 758 | 758 | pub fn wait(req: *Request) WaitError!void { |
| 759 | 759 | while (true) { // handle redirects |
| 760 | 760 | while (true) { // read headers |
| ... | ... | @@ -943,7 +943,7 @@ pub const Request = struct { |
| 943 | 943 | } |
| 944 | 944 | |
| 945 | 945 | /// Write `bytes` to the server. The `transfer_encoding` field determines how data will be sent. |
| 946 | /// Must be called after `start` and before `finish`. | |
| 946 | /// Must be called after `send` and before `finish`. | |
| 947 | 947 | pub fn write(req: *Request, bytes: []const u8) WriteError!usize { |
| 948 | 948 | switch (req.transfer_encoding) { |
| 949 | 949 | .chunked => { |
| ... | ... | @@ -965,7 +965,7 @@ pub const Request = struct { |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /// Write `bytes` to the server. The `transfer_encoding` field determines how data will be sent. |
| 968 | /// Must be called after `start` and before `finish`. | |
| 968 | /// Must be called after `send` and before `finish`. | |
| 969 | 969 | pub fn writeAll(req: *Request, bytes: []const u8) WriteError!void { |
| 970 | 970 | var index: usize = 0; |
| 971 | 971 | while (index < bytes.len) { |
| ... | ... | @@ -976,7 +976,7 @@ pub const Request = struct { |
| 976 | 976 | pub const FinishError = WriteError || error{MessageNotCompleted}; |
| 977 | 977 | |
| 978 | 978 | /// Finish the body of a request. This notifies the server that you have no more data to send. |
| 979 | /// Must be called after `start`. | |
| 979 | /// Must be called after `send`. | |
| 980 | 980 | pub fn finish(req: *Request) FinishError!void { |
| 981 | 981 | switch (req.transfer_encoding) { |
| 982 | 982 | .chunked => try req.connection.?.writer().writeAll("0\r\n\r\n"), |
| ... | ... | @@ -1308,7 +1308,7 @@ pub fn connectTunnel( |
| 1308 | 1308 | }; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | // Prevents a dependency loop in request() | |
| 1311 | // Prevents a dependency loop in open() | |
| 1312 | 1312 | const ConnectErrorPartial = ConnectTcpError || error{ UnsupportedUrlScheme, ConnectionRefused }; |
| 1313 | 1313 | pub const ConnectError = ConnectErrorPartial || RequestError; |
| 1314 | 1314 |
lib/std/http/Server.zig+5-5| ... | ... | @@ -290,7 +290,7 @@ pub const Request = struct { |
| 290 | 290 | /// A HTTP response waiting to be sent. |
| 291 | 291 | /// |
| 292 | 292 | /// [/ <----------------------------------- \] |
| 293 | /// Order of operations: accept -> wait -> do [ -> write -> finish][ -> reset /] | |
| 293 | /// Order of operations: accept -> wait -> send [ -> write -> finish][ -> reset /] | |
| 294 | 294 | /// \ -> read / |
| 295 | 295 | pub const Response = struct { |
| 296 | 296 | version: http.Version = .@"HTTP/1.1", |
| ... | ... | @@ -346,7 +346,7 @@ pub const Response = struct { |
| 346 | 346 | // A connection is only keep-alive if the Connection header is present and it's value is not "close". |
| 347 | 347 | // The server and client must both agree |
| 348 | 348 | // |
| 349 | // do() defaults to using keep-alive if the client requests it. | |
| 349 | // send() defaults to using keep-alive if the client requests it. | |
| 350 | 350 | const res_connection = res.headers.getFirstValue("connection"); |
| 351 | 351 | const res_keepalive = res_connection != null and !std.ascii.eqlIgnoreCase("close", res_connection.?); |
| 352 | 352 | |
| ... | ... | @@ -610,7 +610,7 @@ pub const Response = struct { |
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | /// Write `bytes` to the server. The `transfer_encoding` request header determines how data will be sent. |
| 613 | /// Must be called after `start` and before `finish`. | |
| 613 | /// Must be called after `send` and before `finish`. | |
| 614 | 614 | pub fn write(res: *Response, bytes: []const u8) WriteError!usize { |
| 615 | 615 | switch (res.state) { |
| 616 | 616 | .responded => {}, |
| ... | ... | @@ -637,7 +637,7 @@ pub const Response = struct { |
| 637 | 637 | } |
| 638 | 638 | |
| 639 | 639 | /// Write `bytes` to the server. The `transfer_encoding` request header determines how data will be sent. |
| 640 | /// Must be called after `start` and before `finish`. | |
| 640 | /// Must be called after `send` and before `finish`. | |
| 641 | 641 | pub fn writeAll(req: *Response, bytes: []const u8) WriteError!void { |
| 642 | 642 | var index: usize = 0; |
| 643 | 643 | while (index < bytes.len) { |
| ... | ... | @@ -648,7 +648,7 @@ pub const Response = struct { |
| 648 | 648 | pub const FinishError = WriteError || error{MessageNotCompleted}; |
| 649 | 649 | |
| 650 | 650 | /// Finish the body of a request. This notifies the server that you have no more data to send. |
| 651 | /// Must be called after `start`. | |
| 651 | /// Must be called after `send`. | |
| 652 | 652 | pub fn finish(res: *Response) FinishError!void { |
| 653 | 653 | switch (res.state) { |
| 654 | 654 | .responded => res.state = .finished, |