@@ -906,13 +906,13 @@ private void verifyServerHandshake(InputStream inputStream, String secWebSocketK
906
906
for (String s : lines ) {
907
907
String [] parts = s .split (":" , 2 );
908
908
if (parts .length == 2 ) {
909
- headers .put (parts [0 ].trim (), parts [1 ].trim ());
909
+ headers .put (parts [0 ].trim (). toLowerCase () , parts [1 ].trim ());
910
910
} else {
911
911
throw new InvalidServerHandshakeException ("Invalid headers format" );
912
912
}
913
913
}
914
914
915
- String upgradeValue = headers .get ("Upgrade " );
915
+ String upgradeValue = headers .get ("upgrade " );
916
916
if (upgradeValue == null ) {
917
917
throw new InvalidServerHandshakeException ("There is no header named Upgrade" );
918
918
}
@@ -921,7 +921,7 @@ private void verifyServerHandshake(InputStream inputStream, String secWebSocketK
921
921
throw new InvalidServerHandshakeException ("Invalid value for header Upgrade. Expected: websocket, received: " + upgradeValue );
922
922
}
923
923
924
- String connectionValue = headers .get ("Connection " );
924
+ String connectionValue = headers .get ("connection " );
925
925
if (connectionValue == null ) {
926
926
throw new InvalidServerHandshakeException ("There is no header named Connection" );
927
927
}
@@ -930,7 +930,7 @@ private void verifyServerHandshake(InputStream inputStream, String secWebSocketK
930
930
throw new InvalidServerHandshakeException ("Invalid value for header Connection. Expected: upgrade, received: " + connectionValue );
931
931
}
932
932
933
- String secWebSocketAcceptValue = headers .get ("Sec-WebSocket-Accept " );
933
+ String secWebSocketAcceptValue = headers .get ("sec-websocket-accept " );
934
934
if (secWebSocketAcceptValue == null ) {
935
935
throw new InvalidServerHandshakeException ("There is no header named Sec-WebSocket-Accept" );
936
936
}
0 commit comments