authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-11 14:54:48-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-23 02:37:10-07:00
logf58c59f89f9c49b29facf91937d9d78785824378
tree72983ac466b3e181300b88c2274c2842313ae9c8
parent256c5934bfc19d3b8a1cf01bc07c9ad86a6c6524

std.http.Server: don't emit Server HTTP header

Let the user add that if they wish to. It's not strictly necessary, and arguably a harmful default.

1 files changed, 0 insertions(+), 4 deletions(-)

lib/std/http/Server.zig-4
...@@ -478,10 +478,6 @@ pub const Response = struct {...@@ -478,10 +478,6 @@ pub const Response = struct {
478 if (res.status == .@"continue") {478 if (res.status == .@"continue") {
479 res.state = .waited; // we still need to send another request after this479 res.state = .waited; // we still need to send another request after this
480 } else {480 } else {
481 if (!res.headers.contains("server")) {
482 try w.writeAll("Server: zig (std.http)\r\n");
483 }
484
485 if (!res.headers.contains("connection")) {481 if (!res.headers.contains("connection")) {
486 const req_connection = res.request.headers.getFirstValue("connection");482 const req_connection = res.request.headers.getFirstValue("connection");
487 const req_keepalive = req_connection != null and !std.ascii.eqlIgnoreCase("close", req_connection.?);483 const req_keepalive = req_connection != null and !std.ascii.eqlIgnoreCase("close", req_connection.?);