[#740] Fix WebSocketClientHandshaker00.finishHandshake() validations

This commit is contained in:
Norman Maurer 2012-11-15 13:00:44 +01:00
parent 1e8ed50482
commit d15f9eda08

View File

@ -243,19 +243,19 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
}
String upgrade = response.getHeader(Names.UPGRADE);
if (Values.WEBSOCKET.equals(upgrade)) {
if (!Values.WEBSOCKET.equals(upgrade)) {
throw new WebSocketHandshakeException("Invalid handshake response upgrade: "
+ response.getHeader(Names.UPGRADE));
+ upgrade);
}
String connection = response.getHeader(Names.CONNECTION);
if (Values.UPGRADE.equals(connection)) {
if (!Values.UPGRADE.equals(connection)) {
throw new WebSocketHandshakeException("Invalid handshake response connection: "
+ response.getHeader(Names.CONNECTION));
+ connection);
}
ChannelBuffer challenge = response.getContent();
if (challenge.equals(expectedChallengeResponseBytes)) {
if (!challenge.equals(expectedChallengeResponseBytes)) {
throw new WebSocketHandshakeException("Invalid challenge");
}