tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/facade22/org/apache/tomcat/facade ServletInputStreamFacade.java
Date Fri, 09 Feb 2001 07:46:58 GMT
costin      01/02/08 23:46:58

  Modified:    src/facade22/org/apache/tomcat/facade
                        ServletInputStreamFacade.java
  Log:
  Small fix in InputStreamFacade ( fixing bugs in POST + IS )
  
  Revision  Changes    Path
  1.3       +10 -3     jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletInputStreamFacade.java
  
  Index: ServletInputStreamFacade.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/ServletInputStreamFacade.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ServletInputStreamFacade.java	2000/12/27 17:15:04	1.2
  +++ ServletInputStreamFacade.java	2001/02/09 07:46:58	1.3
  @@ -75,6 +75,7 @@
    */
   final class ServletInputStreamFacade extends ServletInputStream {
       private int bytesRead = 0;
  +    // Stop after reading ContentLength bytes. 
       private int limit = -1;
   
       private Request reqA;
  @@ -84,6 +85,7 @@
   
       void prepare() {
   	int contentLength = reqA.getContentLength();
  +	//System.out.println("ContentLength= " + contentLength);
   	if (contentLength != -1) {
   	    limit=contentLength;
   	}
  @@ -95,13 +97,14 @@
       }
   
       void recycle() {
  -	
  +	limit=-1;
       }
   
       /** Read a byte. Detect if a ByteBuffer is used, if not
        *  use the old method.
        */
       private int doRead() throws IOException {
  +	//System.out.println("DoRead");
   	return reqA.doRead();
       }
   
  @@ -112,6 +115,7 @@
       // -------------------- ServletInputStream methods 
   
       public int read() throws IOException {
  +	//	System.out.println("Read " + limit );
   	if (limit != -1) {
   	    if (bytesRead < limit) {
   		bytesRead++;
  @@ -120,7 +124,9 @@
   		return -1;
   	    }
   	} else {
  -	    return doRead();
  +	    return -1;
  +	    // no content-length, no body
  +	    //	    return doRead();
   	}
       }
   
  @@ -142,7 +148,8 @@
   	    }
   	    return numRead;
   	} else {
  -	    return doRead(b, off, len);
  +	    return 0;
  +	    //return doRead(b, off, len);
   	}
       }
       
  
  
  

Mime
View raw message