You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ke...@apache.org on 2001/02/02 17:41:53 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/server Ajp13.java

keith       01/02/02 08:41:53

  Modified:    src/share/org/apache/tomcat/modules/server Ajp13.java
  Log:
  It may take multiple read() calls to read an entire packet,
  especially w.r.t. uploaded files.
  
  Revision  Changes    Path
  1.11      +12 -9     jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java
  
  Index: Ajp13.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/server/Ajp13.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Ajp13.java	2001/01/30 04:13:14	1.10
  +++ Ajp13.java	2001/02/02 16:41:52	1.11
  @@ -632,16 +632,19 @@
   	int len = msg.checkIn();
   	
   	// XXX check if enough space - it's assert()-ed !!!
  -	// Can we have only one read ( with unblocking, it can read all at once - but maybe more ) ?
  -	
  -	rd = in.read( b, 4, len );
  -	if( rd != len ) {
  -	    System.out.println( "Incomplete read, deal with it " + len + " " + rd);
  -	    // XXX log
  -	    // XXX Return an error code?
  +
  + 	int total_read = 0;
  +  	while (total_read < len) {
  +	    rd = in.read( b, 4 + total_read, len - total_read);
  +            if (rd == -1) {
  + 		System.out.println( "Incomplete read, deal with it " + len + " " + rd);
  +                break;
  +		// XXX log
  +		// XXX Return an error code?
  +	    }
  +     	    total_read += rd;
   	}
  -	// msg.dump( "Incoming");
  -	return rd;
  +	return total_read;
       }
   
       /**