tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Denis Goeury" <>
Subject mod_jk2 ignores ajp13 packets if they contain less than 5 bytes
Date Wed, 21 May 2003 20:15:32 GMT

Apache 2.0.45
Tomcat 4.1.24


mod_jk2 ignores ajp13 packets containing less than 5 bytes of data. Here
is an example of an "ignored" packet containing a two characters string

  Byte   Content    Description

   0      0x12    standard header
   1      0x34    standard header
   2      0x00    data length
   3      0x04    data length
   4      0x00    string length
   5      0x02    string length
   6      0x61    'a'
   7      0x62    'b'

My findings

According to ajp13's documentation the packet's content is perfect.

By looking to Tomcat's source code I found that JkInputStream.receive()
checks the message's length and returns false if it is less than 5. Here
is the source code:

  /** Receive a chunk of data. Called to implement the
   *  'special' packet in ajp13 and to receive the data
   *  after we send a GET_BODY packet
  public boolean receive() throws IOException


    if( bodyMsg.getLen() <= 4 ) { // just the header
      // Don't mark 'end of stream' for the first chunk.
      // end_of_stream = true;
      return false;



It looks like JkInputStream.receive() thinks that MsgAjp.getLen()
returns the total number of bytes in the packet when in fact it returns
the data length (4 with the sample packet). This was confirmed by
connecting a debugger to Tomcat.


Is that a bug in JkInputStream, in MsgAjp, or is there something wrong
with my setup?

Thanks in advance,

Denis Goeury

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message