costin      2002/06/20 11:47:00

  Modified:    jk/java/org/apache/jk/common JkInputStream.java
  Log:
  Few fixes for POST body handling.
  
  Revision  Changes    Path
  1.10      +14 -4     
jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkInputStream.java
  
  Index: JkInputStream.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/JkInputStream.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JkInputStream.java        19 Jun 2002 18:24:49 -0000      1.9
  +++ JkInputStream.java        20 Jun 2002 18:46:59 -0000      1.10
  @@ -180,7 +180,7 @@
       
       // Holds incoming chunks of request body data
       // XXX We do a copy that could be avoided !
  -    byte []bodyBuff = new byte[MAX_READ_SIZE];
  +    byte []bodyBuff = new byte[9000];
       int blen;  // Length of current chunk of body data in buffer
       int pos;   // Current read position within that buffer
   
  @@ -270,14 +270,18 @@
           contentLength=-1;
       }
   
  +    /**
  +     */
       public int doRead(ByteChunk responseChunk ) throws IOException {
           if( log.isDebugEnabled())
  -            log.debug( "doRead " + pos + " " + blen + " " + available + " " + 
end_of_stream);
  +            log.debug( "doRead " + pos + " " + blen + " " + available + " " + 
end_of_stream+
  +                       " " + responseChunk.getOffset()+ " " + 
responseChunk.getLength());
           if( blen == pos ) {
               refillReadBuffer();
           }
  -        responseChunk.setBytes( bodyBuff, pos, blen-pos );
  -        return blen - pos;
  +        responseChunk.setBytes( bodyBuff, pos, blen );
  +        pos=blen;
  +        return blen;
       }
       
       /** Receive a chunk of data. Called to implement the
  @@ -287,9 +291,11 @@
       public boolean receive() throws IOException
       {
           mc.setType( JkHandler.HANDLE_RECEIVE_PACKET );
  +        bodyMsg.reset();
           int err = mc.getSource().invoke(bodyMsg, mc);
           if( log.isDebugEnabled() )
               log.info( "Receiving: getting request body chunk " + err + " " + 
bodyMsg.getLen() );
  +        
           if(err < 0) {
            throw new IOException();
        }
  @@ -307,6 +313,10 @@
   
           if( blen == 0 ) {
               return false;
  +        }
  +
  +        if( blen > bodyBuff.length ) {
  +            bodyMsg.dump("Body");
           }
           
           if( log.isTraceEnabled() ) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to