You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by se...@apache.org on 2002/01/26 05:58:29 UTC

cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/ajp RequestHandler.java

seguin      02/01/25 20:58:29

  Modified:    jk/java/org/apache/ajp RequestHandler.java
  Log:
  fix for bug 5861 -- NumberFormatException when non-standard HTTP header
  with length of 8 characters and non-numeric value is part of request.
  
  patch submitted by ruediger.pluem <at> vodafone-telecommerce.de.
  
  thanks to Nick Wesselman for the test case :)
  
  Revision  Changes    Path
  1.9       +20 -13    jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java
  
  Index: RequestHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/ajp/RequestHandler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- RequestHandler.java	13 Dec 2001 23:32:54 -0000	1.8
  +++ RequestHandler.java	26 Jan 2002 04:58:29 -0000	1.9
  @@ -281,28 +281,35 @@
   	    MessageBytes vMB=null;
               isc &= 0xFF00;
               if(0xA000 == isc) {
  +                //
  +                // header name is encoded as an int
  +                //
                   msg.getInt(); // To advance the read position
                   hName = headerTransArray[hId - 1];
   		vMB= headers.addValue(hName);
  +                msg.getMessageBytes(vMB);
  +
  +                if (hId == SC_REQ_CONTENT_LENGTH) {
  +                    // just read content-length header
  +                    int contentLength = (vMB == null) ? -1 : vMB.getInt();
  +                    req.setContentLength(contentLength);
  +                } else if (hId == SC_REQ_CONTENT_TYPE) {
  +                    // just read content-type header
  +                    ByteChunk bchunk = vMB.getByteChunk();
  +                    req.contentType().setBytes(bchunk.getBytes(),
  +                                               bchunk.getOffset(),
  +                                               bchunk.getLength());
  +                }
               } else {
  +                //
  +                // header name is a string
  +                //
   		// XXX Not very elegant
   		vMB = msg.addHeader(headers);
   		if (vMB == null) {
                       return 500; // wrong packet
                   }
  -            }
  -
  -            msg.getMessageBytes(vMB);
  -
  -            // set content length, if this is it...
  -            if (hId == SC_REQ_CONTENT_LENGTH) {
  -                int contentLength = (vMB == null) ? -1 : vMB.getInt();
  -                req.setContentLength(contentLength);
  -            } else if (hId == SC_REQ_CONTENT_TYPE) {
  -                ByteChunk bchunk = vMB.getByteChunk();
  -                req.contentType().setBytes(bchunk.getBytes(),
  -                                           bchunk.getOffset(),
  -                                           bchunk.getLength());
  +                msg.getMessageBytes(vMB);
               }
           }
   
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>