parent
50f8cc98d1
commit
c01f08d306
@ -41,7 +41,7 @@ class WebSocketServerProtocolHandshakeHandler extends ChannelHandlerAdapter {
|
||||
private final String subprotocols;
|
||||
private final boolean allowExtensions;
|
||||
|
||||
public WebSocketServerProtocolHandshakeHandler(String websocketPath, String subprotocols,
|
||||
WebSocketServerProtocolHandshakeHandler(String websocketPath, String subprotocols,
|
||||
boolean allowExtensions) {
|
||||
this.websocketPath = websocketPath;
|
||||
this.subprotocols = subprotocols;
|
||||
@ -51,6 +51,7 @@ class WebSocketServerProtocolHandshakeHandler extends ChannelHandlerAdapter {
|
||||
@Override
|
||||
public void channelRead(final ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
FullHttpRequest req = (FullHttpRequest) msg;
|
||||
try {
|
||||
if (req.getMethod() != GET) {
|
||||
sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, FORBIDDEN));
|
||||
return;
|
||||
@ -78,6 +79,9 @@ class WebSocketServerProtocolHandshakeHandler extends ChannelHandlerAdapter {
|
||||
ctx.pipeline().replace(this, "WS403Responder",
|
||||
WebSocketServerProtocolHandler.forbiddenHttpRequestResponder());
|
||||
}
|
||||
} finally {
|
||||
req.release();
|
||||
}
|
||||
}
|
||||
|
||||
private static void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) {
|
||||
|
Loading…
Reference in New Issue
Block a user