Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fb07c99

Browse files
Accept lower case response headers
1 parent 66e6384 commit fb07c99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/main/java/dev/gustavoavila/websocketclient/WebSocketClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,13 +906,13 @@ private void verifyServerHandshake(InputStream inputStream, String secWebSocketK
906906
for (String s : lines) {
907907
String[] parts = s.split(":", 2);
908908
if (parts.length == 2) {
909-
headers.put(parts[0].trim(), parts[1].trim());
909+
headers.put(parts[0].trim().toLowerCase(), parts[1].trim());
910910
} else {
911911
throw new InvalidServerHandshakeException("Invalid headers format");
912912
}
913913
}
914914

915-
String upgradeValue = headers.get("Upgrade");
915+
String upgradeValue = headers.get("upgrade");
916916
if (upgradeValue == null) {
917917
throw new InvalidServerHandshakeException("There is no header named Upgrade");
918918
}
@@ -921,7 +921,7 @@ private void verifyServerHandshake(InputStream inputStream, String secWebSocketK
921921
throw new InvalidServerHandshakeException("Invalid value for header Upgrade. Expected: websocket, received: " + upgradeValue);
922922
}
923923

924-
String connectionValue = headers.get("Connection");
924+
String connectionValue = headers.get("connection");
925925
if (connectionValue == null) {
926926
throw new InvalidServerHandshakeException("There is no header named Connection");
927927
}
@@ -930,7 +930,7 @@ private void verifyServerHandshake(InputStream inputStream, String secWebSocketK
930930
throw new InvalidServerHandshakeException("Invalid value for header Connection. Expected: upgrade, received: " + connectionValue);
931931
}
932932

933-
String secWebSocketAcceptValue = headers.get("Sec-WebSocket-Accept");
933+
String secWebSocketAcceptValue = headers.get("sec-websocket-accept");
934934
if (secWebSocketAcceptValue == null) {
935935
throw new InvalidServerHandshakeException("There is no header named Sec-WebSocket-Accept");
936936
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /