Skip to content

Commit 1a7f4ae

Browse files
authored
make header values for WebSocket upgrade case insensitive (#9)
1 parent a701de8 commit 1a7f4ae

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

server/server.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,15 @@ func isWebSocketUpgrade(header http.Header) (bool, error) {
196196
if header.Get("Sec-Websocket-Protocol") != grpcwebsocket.SubprotocolName {
197197
return false, nil
198198
}
199-
if header.Get("Connection") != "Upgrade" {
199+
200+
if !strings.EqualFold(header.Get("Connection"), "upgrade") {
200201
return false, errors.New("missing 'Connection: Upgrade' header in gRPC-websocket request (this usually means your proxy or load balancer does not support websockets)")
201202
}
202-
if header.Get("Upgrade") != "websocket" {
203+
204+
if !strings.EqualFold(header.Get("Upgrade"), "websocket") {
203205
return false, errors.New("missing 'Upgrade: websocket' header in gRPC-websocket request (this usually means your proxy or load balancer does not support websockets)")
204206
}
207+
205208
return true, nil
206209
}
207210

0 commit comments

Comments
 (0)