[#740] Fix WebSocketClientHandshaker00.finishHandshake() validations

This commit is contained in:
Norman Maurer 2012-11-15 13:06:48 +01:00
parent 46d713970b
commit d28eca7138

View File

@ -228,15 +228,15 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
} }
String upgrade = response.getHeader(Names.UPGRADE); String upgrade = response.getHeader(Names.UPGRADE);
if (Values.WEBSOCKET.equalsIgnoreCase(upgrade)) { if (!Values.WEBSOCKET.equalsIgnoreCase(upgrade)) {
throw new WebSocketHandshakeException("Invalid handshake response upgrade: " throw new WebSocketHandshakeException("Invalid handshake response upgrade: "
+ response.getHeader(Names.UPGRADE)); + upgrade);
} }
String connection = response.getHeader(Names.CONNECTION); String connection = response.getHeader(Names.CONNECTION);
if (Values.UPGRADE.equalsIgnoreCase(connection)) { if (!Values.UPGRADE.equalsIgnoreCase(connection)) {
throw new WebSocketHandshakeException("Invalid handshake response connection: " throw new WebSocketHandshakeException("Invalid handshake response connection: "
+ response.getHeader(Names.CONNECTION)); + connection);
} }
byte[] challenge = response.getContent().array(); byte[] challenge = response.getContent().array();