authorgravatar for jord_id@abv.bgJordyfel <jord_id@abv.bg> 2023-11-01 11:57:07+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-11-01 14:46:00+02:00
log61861ef3953a64a62868cde912e2ff56c2df441a
treea894047fe9aed29648ae70275cd4965fbd037720
parent084a7cf0285a17b94ccf7822a4b3496d401e6cd8

std.http: account for renames in docs


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

lib/std/http/Client.zig+6-6
...@@ -521,7 +521,7 @@ pub const Response = struct {...@@ -521,7 +521,7 @@ pub const Response = struct {
521521
522/// A HTTP request that has been sent.522/// A HTTP request that has been sent.
523///523///
524/// Order of operations: request -> start[ -> write -> finish] -> wait -> read524/// Order of operations: open -> send[ -> write -> finish] -> wait -> read
525pub const Request = struct {525pub const Request = struct {
526 uri: Uri,526 uri: Uri,
527 client: *Client,527 client: *Client,
...@@ -754,7 +754,7 @@ pub const Request = struct {...@@ -754,7 +754,7 @@ pub const Request = struct {
754 /// If `handle_redirects` is true and the request has no payload, then this function will automatically follow754 /// If `handle_redirects` is true and the request has no payload, then this function will automatically follow
755 /// redirects. If a request payload is present, then this function will error with error.RedirectRequiresResend.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 pub fn wait(req: *Request) WaitError!void {758 pub fn wait(req: *Request) WaitError!void {
759 while (true) { // handle redirects759 while (true) { // handle redirects
760 while (true) { // read headers760 while (true) { // read headers
...@@ -943,7 +943,7 @@ pub const Request = struct {...@@ -943,7 +943,7 @@ pub const Request = struct {
943 }943 }
944944
945 /// Write `bytes` to the server. The `transfer_encoding` field determines how data will be sent.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 pub fn write(req: *Request, bytes: []const u8) WriteError!usize {947 pub fn write(req: *Request, bytes: []const u8) WriteError!usize {
948 switch (req.transfer_encoding) {948 switch (req.transfer_encoding) {
949 .chunked => {949 .chunked => {
...@@ -965,7 +965,7 @@ pub const Request = struct {...@@ -965,7 +965,7 @@ pub const Request = struct {
965 }965 }
966966
967 /// Write `bytes` to the server. The `transfer_encoding` field determines how data will be sent.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 pub fn writeAll(req: *Request, bytes: []const u8) WriteError!void {969 pub fn writeAll(req: *Request, bytes: []const u8) WriteError!void {
970 var index: usize = 0;970 var index: usize = 0;
971 while (index < bytes.len) {971 while (index < bytes.len) {
...@@ -976,7 +976,7 @@ pub const Request = struct {...@@ -976,7 +976,7 @@ pub const Request = struct {
976 pub const FinishError = WriteError || error{MessageNotCompleted};976 pub const FinishError = WriteError || error{MessageNotCompleted};
977977
978 /// Finish the body of a request. This notifies the server that you have no more data to send.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 pub fn finish(req: *Request) FinishError!void {980 pub fn finish(req: *Request) FinishError!void {
981 switch (req.transfer_encoding) {981 switch (req.transfer_encoding) {
982 .chunked => try req.connection.?.writer().writeAll("0\r\n\r\n"),982 .chunked => try req.connection.?.writer().writeAll("0\r\n\r\n"),
...@@ -1308,7 +1308,7 @@ pub fn connectTunnel(...@@ -1308,7 +1308,7 @@ pub fn connectTunnel(
1308 };1308 };
1309}1309}
13101310
1311// Prevents a dependency loop in request()1311// Prevents a dependency loop in open()
1312const ConnectErrorPartial = ConnectTcpError || error{ UnsupportedUrlScheme, ConnectionRefused };1312const ConnectErrorPartial = ConnectTcpError || error{ UnsupportedUrlScheme, ConnectionRefused };
1313pub const ConnectError = ConnectErrorPartial || RequestError;1313pub const ConnectError = ConnectErrorPartial || RequestError;
13141314
lib/std/http/Server.zig+5-5
...@@ -290,7 +290,7 @@ pub const Request = struct {...@@ -290,7 +290,7 @@ pub const Request = struct {
290/// A HTTP response waiting to be sent.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/// \ -> read /294/// \ -> read /
295pub const Response = struct {295pub const Response = struct {
296 version: http.Version = .@"HTTP/1.1",296 version: http.Version = .@"HTTP/1.1",
...@@ -346,7 +346,7 @@ pub const Response = struct {...@@ -346,7 +346,7 @@ pub const Response = struct {
346 // A connection is only keep-alive if the Connection header is present and it's value is not "close".346 // A connection is only keep-alive if the Connection header is present and it's value is not "close".
347 // The server and client must both agree347 // 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 const res_connection = res.headers.getFirstValue("connection");350 const res_connection = res.headers.getFirstValue("connection");
351 const res_keepalive = res_connection != null and !std.ascii.eqlIgnoreCase("close", res_connection.?);351 const res_keepalive = res_connection != null and !std.ascii.eqlIgnoreCase("close", res_connection.?);
352352
...@@ -610,7 +610,7 @@ pub const Response = struct {...@@ -610,7 +610,7 @@ pub const Response = struct {
610 }610 }
611611
612 /// Write `bytes` to the server. The `transfer_encoding` request header determines how data will be sent.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 pub fn write(res: *Response, bytes: []const u8) WriteError!usize {614 pub fn write(res: *Response, bytes: []const u8) WriteError!usize {
615 switch (res.state) {615 switch (res.state) {
616 .responded => {},616 .responded => {},
...@@ -637,7 +637,7 @@ pub const Response = struct {...@@ -637,7 +637,7 @@ pub const Response = struct {
637 }637 }
638638
639 /// Write `bytes` to the server. The `transfer_encoding` request header determines how data will be sent.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 pub fn writeAll(req: *Response, bytes: []const u8) WriteError!void {641 pub fn writeAll(req: *Response, bytes: []const u8) WriteError!void {
642 var index: usize = 0;642 var index: usize = 0;
643 while (index < bytes.len) {643 while (index < bytes.len) {
...@@ -648,7 +648,7 @@ pub const Response = struct {...@@ -648,7 +648,7 @@ pub const Response = struct {
648 pub const FinishError = WriteError || error{MessageNotCompleted};648 pub const FinishError = WriteError || error{MessageNotCompleted};
649649
650 /// Finish the body of a request. This notifies the server that you have no more data to send.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 pub fn finish(res: *Response) FinishError!void {652 pub fn finish(res: *Response) FinishError!void {
653 switch (res.state) {653 switch (res.state) {
654 .responded => res.state = .finished,654 .responded => res.state = .finished,