jbertram commented on code in PR #5908:
URL: https://github.com/apache/activemq-artemis/pull/5908#discussion_r2330602103


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/ProtocolHandler.java:
##########
@@ -184,7 +208,9 @@ public void channelRead(ChannelHandlerContext ctx, Object 
msg) throws Exception
                ctx.writeAndFlush(new DefaultFullHttpResponse(HTTP_1_1, 
FORBIDDEN)).addListener(ChannelFutureListener.CLOSE);
             }
          } else {
-            super.channelRead(ctx, msg);
+            // slice off the proxy-related bytes that have already been read 
so other protocol handlers don't choke on them
+            super.channelRead(ctx, skipProxyBytes ? ((ByteBuf) msg).slice() : 
msg);
+            skipProxyBytes = false;

Review Comment:
   The problem doesn't happen when processing the `HAProxyMessage` but rather 
on the next invocation of `channelRead` where the buffer still contains the 
PROXY Protocol bytes that were already read along with the bytes from the real 
messaging protocol. I'm no Netty expert so maybe there's a better way to deal 
with this.
   
   In any case, I'll use an explicit `if`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to