Cleanup
This commit is contained in:
parent
3acb22c38c
commit
43ff36cef0
@ -17,6 +17,7 @@ package io.netty.handler.codec.http;
|
|||||||
|
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.ByteBufHolder;
|
import io.netty.buffer.ByteBufHolder;
|
||||||
|
import io.netty.buffer.ReferenceCounted;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.embedded.EmbeddedByteChannel;
|
import io.netty.channel.embedded.EmbeddedByteChannel;
|
||||||
@ -51,6 +52,10 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
|
|||||||
protected Object decode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
protected Object decode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||||
if (msg instanceof HttpResponse && ((HttpResponse) msg).getStatus().code() == 100) {
|
if (msg instanceof HttpResponse && ((HttpResponse) msg).getStatus().code() == 100) {
|
||||||
// 100-continue response must be passed through.
|
// 100-continue response must be passed through.
|
||||||
|
if (msg instanceof ReferenceCounted) {
|
||||||
|
// need to call retain to not free it
|
||||||
|
((ReferenceCounted) msg).retain();
|
||||||
|
}
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
if (msg instanceof HttpMessage) {
|
if (msg instanceof HttpMessage) {
|
||||||
@ -99,15 +104,13 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
|
|||||||
return decoded;
|
return decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
c.retain();
|
return new Object[] { message, c.retain() };
|
||||||
return new Object[] { message, c };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (decoder != null) {
|
if (decoder != null) {
|
||||||
return decodeContent(null, c);
|
return decodeContent(null, c);
|
||||||
} else {
|
} else {
|
||||||
c.retain();
|
return c.retain();
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user