From ea20237166b8487e49f25da09304c8711e666445 Mon Sep 17 00:00:00 2001 From: Thijmen Stavenuiter Date: Wed, 20 Jan 2021 18:05:00 +0100 Subject: [PATCH 1/2] Add logging for mismatched Websocket Origin --- .../plugin/nitro/websockets/codec/WebSocketCodec.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java b/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java index c7afa24..3e05268 100644 --- a/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java +++ b/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java @@ -6,12 +6,18 @@ import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageCodec; import io.netty.handler.codec.http.websocketx.*; +import org.krews.plugin.nitro.main; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.net.URI; import java.net.URISyntaxException; import java.util.List; public class WebSocketCodec extends MessageToMessageCodec { + + private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketCodec.class); + @Override protected void encode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { out.add(new BinaryWebSocketFrame(in).retain()); @@ -53,6 +59,7 @@ public class WebSocketCodec extends MessageToMessageCodec Date: Thu, 21 Jan 2021 11:05:11 +0100 Subject: [PATCH 2/2] Only debug line when debugging is enabled --- .../krews/plugin/nitro/websockets/codec/WebSocketCodec.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java b/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java index 3e05268..3bf7960 100644 --- a/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java +++ b/src/main/java/org/krews/plugin/nitro/websockets/codec/WebSocketCodec.java @@ -59,7 +59,10 @@ public class WebSocketCodec extends MessageToMessageCodec