Fix a bug where HttpContentDecoder emits duplicate HttpMessage or raises NPE
This commit is contained in:
parent
61bbb04852
commit
27190fcb7f
@ -56,7 +56,7 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
|
||||
if (msg instanceof HttpMessage) {
|
||||
assert message == null;
|
||||
message = (HttpMessage) msg;
|
||||
|
||||
decodeStarted = false;
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@ -100,11 +100,15 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
|
||||
}
|
||||
return new Object[] { message, c };
|
||||
}
|
||||
return decodeContent(null, c);
|
||||
|
||||
if (decoder != null) {
|
||||
return decodeContent(null, c);
|
||||
} else {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
// Because FullHttpMessage and HttpChunk is a mutable object, we can simply forward it.
|
||||
return msg;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class HttpSnoopClientInitializer extends ChannelInitializer<SocketChannel
|
||||
p.addLast("inflater", new HttpContentDecompressor());
|
||||
|
||||
// Uncomment the following line if you don't want to handle HttpChunks.
|
||||
//pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
|
||||
//p.addLast("aggregator", new HttpObjectAggregator(1048576));
|
||||
|
||||
p.addLast("handler", new HttpSnoopClientHandler());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user