[#1046] Make sure HttpContentEncoder calls ByteBuf.retain() if needed

This commit is contained in:
Norman Maurer 2013-02-12 20:32:27 +01:00
parent 1cc04e7dda
commit fcba55329c

View File

@ -129,10 +129,12 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
Result result = beginEncode(message, c, acceptEncoding);
if (result == null) {
ByteBuf data = c.data();
data.retain();
if (c instanceof LastHttpContent) {
return new Object[] { message, new DefaultLastHttpContent(c.data()) };
return new Object[] { message, new DefaultLastHttpContent(data) };
} else {
return new Object[] { message, new DefaultHttpContent(c.data()) };
return new Object[] { message, new DefaultHttpContent(data) };
}
}