Skip to content

Commit e17dfb9

Browse files
linusgandrewrk
authored andcommitted
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_."
1 parent 54611e3 commit e17dfb9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/http/WebSocket.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn init(
3030
if (std.ascii.eqlIgnoreCase(header.name, "sec-websocket-key")) {
3131
sec_websocket_key = header.value;
3232
} else if (std.ascii.eqlIgnoreCase(header.name, "upgrade")) {
33-
if (!std.mem.eql(u8, header.value, "websocket"))
33+
if (!std.ascii.eqlIgnoreCase(header.value, "websocket"))
3434
return false;
3535
upgrade_websocket = true;
3636
}

0 commit comments

Comments
 (0)