Hi Trustin Thanks for the info.
I found out yesterday just what you've told me now in org.apache.mina.filter.codec.CumulativeProtocolDecoder#decode( ). Thanks for the confirmation. There is a bug in the http server codec example. If it receives more than one http message in a single tcp transmission it does wrongly assumes that a single http message arrived in "HttpRequestDecoder#messageComplete( ): boolean". It shouldn't test if the last bytes are 0x0D 0x0A 0x0D 0x0A, because the buffer could contain: [First Message correctly terminated (0x0D 0x0A 0x0D 0x0A) + Second Incomplete Message (not 0x0D 0x0A 0x0D 0x0A terminated)]. Bogdan On Jan 21, 2008 10:12 AM, Trustin Lee <[EMAIL PROTECTED]> wrote: > Hi Bogdan, > > On Jan 18, 2008 8:06 PM, Bogdan Ciprian Pistol <[EMAIL PROTECTED]> wrote: > > Hello, > > > > Suppose that in a decode(IoSession session, IoBuffer in, > > ProtocolDecoderOutput out) call the IoBuffer is read and some objects > > are written to the ProtocolDecoderOutput. Suppose that the IoBuffer > > contains some more data, but not enough for creating another object > > (to write to the ProtocolDecoderOutput), so I return > > MessageDecoderResult.NEED_DATA. > > You are just safe to return MessageDecoderResult.OK after decoding > only one message. decode() will be invoked again and again until you > return NEED_DATA. > > > What will the IoBuffer contain when more data is available ? > > The old not enough remaining data + the new available data ? > > Yes. You can get the IoBuffer with non-zero position. > > HTH, > Trustin > -- > what we call human nature is actually human habit > -- > http://gleamynode.net/ > -- > PGP Key ID: 0x0255ECA6 >