Closed ocram closed 8 years ago
I agree. I have worked well with Meteor websocket and TubeSock. But, the last TubeSock throw exception in handshaking.
I think the code to make header map of WebSocket.runReader() had better be changed like this:
for (String line : handshakeLines)
{
String[] keyValue = line.split(": ", 2);
headers.put(keyValue[0].toLowerCase(Locale.US), keyValue[1]);
}
And, WebSocketHandShake.verifyServerHandshakeHeaders method had better be changed like this :
public void verifyServerHandshakeHeaders(HashMap<String, String> headers)
{
if (!headers.get("upgrade").toLowerCase(Locale.US).equals("websocket"))
{
throw new WebSocketException("connection failed: missing header field in server handshake: Upgrade");
}
else if (!headers.get("connection").toLowerCase(Locale.US).equals("upgrade"))
{
throw new WebSocketException("connection failed: missing header field in server handshake: Connection");
}
}
@gsoltis Can you merge this pull request?
and
The field values are already handled case-insensitively in
WebSocketHandshake.java
(also as per RFC 6455, 4.1). But the field keys still need to be fixed.