Skip to content

Commit

Permalink
Fix Netty4 header verifier inbound handler to deal with upgrade reque…
Browse files Browse the repository at this point in the history
…sts (opensearch-project#5045)

Signed-off-by: Andriy Redko <[email protected]>
(cherry picked from commit 2bef10c)
  • Loading branch information
reta committed Jan 21, 2025
1 parent d11348a commit 8abcd19
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.DefaultHttpRequest;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.util.AttributeKey;
import io.netty.util.ReferenceCountUtil;

@Sharable
public class Netty4HttpRequestHeaderVerifier extends SimpleChannelInboundHandler<DefaultHttpRequest> {
public class Netty4HttpRequestHeaderVerifier extends SimpleChannelInboundHandler<HttpRequest> {
public static final AttributeKey<Boolean> IS_AUTHENTICATED = AttributeKey.newInstance("opensearch-http-is-authenticated");
public static final AttributeKey<Boolean> SHOULD_DECOMPRESS = AttributeKey.newInstance("opensearch-http-should-decompress");
public static final AttributeKey<ThreadContext.StoredContext> CONTEXT_TO_RESTORE = AttributeKey.newInstance(
Expand Down Expand Up @@ -67,7 +66,7 @@ public Netty4HttpRequestHeaderVerifier(SecurityRestFilter restFilter, ThreadPool
}

@Override
public void channelRead0(ChannelHandlerContext ctx, DefaultHttpRequest msg) throws Exception {
public void channelRead0(ChannelHandlerContext ctx, HttpRequest msg) throws Exception {
// DefaultHttpRequest should always be first and contain headers
ReferenceCountUtil.retain(msg);

Expand Down

0 comments on commit 8abcd19

Please sign in to comment.