A chunked state overwrite trap in HttpMessageEncoder
"이희승 (Trustin Lee)"
trustin at gmail.com
Wed Nov 10 23:43:11 EST 2010
You should create a new HttpMessageEncoder for each channel - it's not
annotated with @Sharable.
zhongl wrote:
> Hi, i found another trap in HttpMessageEncoder as blow:
>
> private volatile boolean chunked;
>
> protected Object encode(ChannelHandlerContext ctx, Channel channel,
> Object msg) throws Exception {
> if (msg instanceof HttpMessage) {
> HttpMessage m = (HttpMessage) msg;
> boolean chunked = this.chunked =
> HttpCodecUtil.isTransferEncodingChunked(m);
> ...
> }
>
> if (msg instanceof HttpChunk) {
> HttpChunk chunk = (HttpChunk) msg;
> if (chunked) {
> ...
> }
> ...
> }
> ...
> }
>
> If there are two channels(a & b) have to response :
>
> timeline :
> -------------------------------------------------------------------------->
> channel a : [0]write(chunked
> response)-------------------------------[1]write(chunk)--
> channel b : ---------------------------[0]write(non-chunked
> response)-----------------
>
> In this case, a[1] chunk will be treated as a ChannelBuffer, because
> HttpMessageEncoder.chunked has be overwrite to "false".
>
> Should chunked state be bound to Channel, not HttpMessageEncoder?
>
> Thanks,
>
> Zhongl
--
Trustin Lee - http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 290 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20101111/fcaebe2f/attachment.bin
More information about the netty-users
mailing list