keith       2005/02/27 10:18:02

  Modified:    coyote/src/java/org/apache/coyote Response.java
               http11/src/java/org/apache/coyote/http11
                        Http11Processor.java
               coyote/src/java/org/apache/coyote/tomcat4 OutputBuffer.java
  Log:
  Allow servlets to return multi-gb content-length headers
  
  - allow servlets to set content-length > Integer.MAX_VALUE via setHeader()
  - if servlet sets a content length in this manner, getContentLength will
    return -1 if cl > Integer.MAX_VALUE, so test getContentLengthLong to see
    if the cl was set.
  
  Revision  Changes    Path
  1.36      +5 -1      
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java
  
  Index: Response.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/Response.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- Response.java     10 Dec 2004 00:00:00 -0000      1.35
  +++ Response.java     27 Feb 2005 18:18:02 -0000      1.36
  @@ -350,7 +350,7 @@
           }
           if( name.equalsIgnoreCase( "Content-Length" ) ) {
               try {
  -                int cL=Integer.parseInt( value );
  +                long cL=Long.parseLong( value );
                   setContentLength( cL );
                   return true;
               } catch( NumberFormatException ex ) {
  @@ -528,6 +528,10 @@
           this.contentLength = contentLength;
       }
   
  +    public void setContentLength(long contentLength) {
  +        this.contentLength = contentLength;
  +    }
  +
       public int getContentLength() {
           long length = getContentLengthLong();
           
  
  
  
  1.118     +1 -1      
jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java
  
  Index: Http11Processor.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Processor.java,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- Http11Processor.java      6 Jan 2005 12:43:15 -0000       1.117
  +++ Http11Processor.java      27 Feb 2005 18:18:02 -0000      1.118
  @@ -1413,7 +1413,7 @@
           }
   
           // Check if suffisant len to trig the compression
  -        int contentLength = response.getContentLength();
  +        long contentLength = response.getContentLengthLong();
           if ((contentLength == -1)
               || (contentLength > compressionMinSize)) {
               // Check for compatible MIME-TYPE
  
  
  
  1.15      +1 -1      
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java
  
  Index: OutputBuffer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4/OutputBuffer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- OutputBuffer.java 17 Sep 2004 18:34:18 -0000      1.14
  +++ OutputBuffer.java 27 Feb 2005 18:18:02 -0000      1.15
  @@ -265,7 +265,7 @@
               return;
   
           if ((!coyoteResponse.isCommitted()) 
  -            && (coyoteResponse.getContentLength() == -1)) {
  +            && (coyoteResponse.getContentLengthLong() == -1)) {
               // Flushing the char buffer
               if (state == CHAR_STATE) {
                   cb.flushBuffer();
  
  
  

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

Reply via email to