|
|
|
@ -228,10 +228,19 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life |
|
|
|
handleInvalidUpgradeHeader(request, response); |
|
|
|
handleInvalidUpgradeHeader(request, response); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!headers.getConnection().contains("Upgrade") && !headers.getConnection().contains("upgrade")) { |
|
|
|
List<String> connectionValue = headers.getConnection(); |
|
|
|
|
|
|
|
if (!connectionValue.contains("Upgrade") && !connectionValue.contains("upgrade")) { |
|
|
|
handleInvalidConnectHeader(request, response); |
|
|
|
handleInvalidConnectHeader(request, response); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String key = headers.getSecWebSocketKey(); |
|
|
|
|
|
|
|
if (key == null) { |
|
|
|
|
|
|
|
if (logger.isErrorEnabled()) { |
|
|
|
|
|
|
|
logger.error("Missing \"Sec-WebSocket-Key\" header"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
response.setStatusCode(HttpStatus.BAD_REQUEST); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!isWebSocketVersionSupported(headers)) { |
|
|
|
if (!isWebSocketVersionSupported(headers)) { |
|
|
|
handleWebSocketVersionNotSupported(request, response); |
|
|
|
handleWebSocketVersionNotSupported(request, response); |
|
|
|
@ -241,16 +250,6 @@ public abstract class AbstractHandshakeHandler implements HandshakeHandler, Life |
|
|
|
response.setStatusCode(HttpStatus.FORBIDDEN); |
|
|
|
response.setStatusCode(HttpStatus.FORBIDDEN); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (HttpMethod.GET == httpMethod) { |
|
|
|
|
|
|
|
String wsKey = headers.getSecWebSocketKey(); |
|
|
|
|
|
|
|
if (wsKey == null) { |
|
|
|
|
|
|
|
if (logger.isErrorEnabled()) { |
|
|
|
|
|
|
|
logger.error("Missing \"Sec-WebSocket-Key\" header"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
response.setStatusCode(HttpStatus.BAD_REQUEST); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
catch (IOException ex) { |
|
|
|
catch (IOException ex) { |
|
|
|
throw new HandshakeFailureException( |
|
|
|
throw new HandshakeFailureException( |
|
|
|
|