mirror of
https://github.com/ziglang/zig.git
synced 2024-11-26 23:22:44 +00:00
std.http.WebSocket: Make 'upgrade: websocket' check case-insensitive
I've seen implementations in the wild that send 'Upgrade: WebSocket', which currently fails the handshake. From https://datatracker.ietf.org/doc/html/rfc6455: "If the response lacks an |Upgrade| header field or the |Upgrade| header field contains a value that is not an ASCII case-insensitive match for the value "websocket", the client MUST _Fail the WebSocket Connection_."
This commit is contained in:
parent
54611e32d7
commit
e17dfb9da0
@ -30,7 +30,7 @@ pub fn init(
|
||||
if (std.ascii.eqlIgnoreCase(header.name, "sec-websocket-key")) {
|
||||
sec_websocket_key = header.value;
|
||||
} else if (std.ascii.eqlIgnoreCase(header.name, "upgrade")) {
|
||||
if (!std.mem.eql(u8, header.value, "websocket"))
|
||||
if (!std.ascii.eqlIgnoreCase(header.value, "websocket"))
|
||||
return false;
|
||||
upgrade_websocket = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user