@@ -29,7 +29,6 @@ public class Netty4HttpHeaderValidator extends ChannelDuplexHandler {
2929 private final ThreadContext threadContext ;
3030 private boolean droppingContent ;
3131 private boolean validatingRequest ;
32- private boolean readRequested ;
3332
3433 public Netty4HttpHeaderValidator (HttpValidator validator , ThreadContext threadContext ) {
3534 this .validator = validator ;
@@ -62,14 +61,18 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
6261 public void read (ChannelHandlerContext ctx ) throws Exception {
6362 // until validation is completed we can ignore read calls,
6463 // once validation is finished HttpRequest will be fired and downstream can read from there
65- if (validatingRequest ) {
66- readRequested = true ;
67- } else {
68- readRequested = false ;
64+ if (validatingRequest == false ) {
6965 ctx .read ();
7066 }
7167 }
7268
69+ @ Override
70+ public void channelReadComplete (ChannelHandlerContext ctx ) throws Exception {
71+ if (validatingRequest == false ) {
72+ ctx .fireChannelReadComplete ();
73+ }
74+ }
75+
7376 void validate (ChannelHandlerContext ctx , HttpRequest request ) {
7477 assert Transports .assertDefaultThreadContext (threadContext );
7578 droppingContent = false ;
@@ -113,10 +116,7 @@ void handleValidationResult(ChannelHandlerContext ctx, HttpRequest request, @Nul
113116 }
114117 validatingRequest = false ;
115118 ctx .fireChannelRead (request );
116- if (readRequested ) {
117- readRequested = false ;
118- ctx .channel ().eventLoop ().execute (ctx ::read );
119- }
119+ ctx .fireChannelReadComplete ();
120120 });
121121 }
122122
0 commit comments