authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-05 13:31:26-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-05 13:31:26-07:00
log450f3bc9250eca86b470ec29c228165054016c76
treeaf00566cf5a7044a760147f01b2f5ed7f4ce3e85
parentba1e53f116b27f97828d495af2ea5b87fd9632cb

std.http.Class: classify out-of-range codes as server_error

RFC 9110 section 15: Values outside the range 100..599 are invalid. Implementations often use three-digit integer values outside of that range (i.e., 600..999) for internal communication of non-HTTP status (e.g., library errors). A client that receives a response with an invalid status code SHOULD process the response as if it had a 5xx (Server Error) status code.

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

lib/std/http.zig+1-3
...@@ -218,7 +218,6 @@ pub const Status = enum(u10) {...@@ -218,7 +218,6 @@ pub const Status = enum(u10) {
218 }218 }
219219
220 pub const Class = enum {220 pub const Class = enum {
221 nonstandard,
222 informational,221 informational,
223 success,222 success,
224 redirect,223 redirect,
...@@ -232,8 +231,7 @@ pub const Status = enum(u10) {...@@ -232,8 +231,7 @@ pub const Status = enum(u10) {
232 200...299 => .success,231 200...299 => .success,
233 300...399 => .redirect,232 300...399 => .redirect,
234 400...499 => .client_error,233 400...499 => .client_error,
235 500...599 => .server_error,234 else => .server_error,
236 else => .nonstandard,
237 };235 };
238 }236 }
239237