tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Http11Connector.java InternalInputBuffer.java InternalOutputBuffer.java
Date Tue, 01 Jan 2002 21:34:01 GMT
remm        02/01/01 13:34:01

  Modified:    http11/src/java/org/apache/coyote/http11
                        Http11Connector.java InternalInputBuffer.java
                        InternalOutputBuffer.java
  Log:
  - Implement more functionality.
  
  Revision  Changes    Path
  1.6       +32 -7     jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Connector.java
  
  Index: Http11Connector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/Http11Connector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Http11Connector.java	24 Dec 2001 20:44:40 -0000	1.5
  +++ Http11Connector.java	1 Jan 2002 21:34:01 -0000	1.6
  @@ -67,6 +67,7 @@
   
   import org.apache.tomcat.util.buf.ByteChunk;
   import org.apache.tomcat.util.buf.MessageBytes;
  +import org.apache.tomcat.util.http.MimeHeaders;
   
   import org.apache.coyote.ActionHook;
   import org.apache.coyote.ActionCode;
  @@ -283,6 +284,7 @@
                   error = true;
               } catch (Throwable t) {
                   // ISE
  +                t.printStackTrace();
                   error = true;
               }
   
  @@ -293,6 +295,7 @@
                   error = true;
               } catch (Throwable t) {
                   // Problem ...
  +                t.printStackTrace();
                   error = true;
               }
   
  @@ -326,6 +329,7 @@
                   outputBuffer.commit();
               } catch (IOException e) {
                   // Log the error, and set error flag
  +                e.printStackTrace();
                   error = true;
               }
   
  @@ -347,6 +351,7 @@
                   outputBuffer.endRequest();
               } catch (IOException e) {
                   // Log the error, and set error flag
  +                e.printStackTrace();
                   error = true;
               }
   
  @@ -415,13 +420,15 @@
           // Check connection header
           MessageBytes connectionValueMB = 
               request.getMimeHeaders().getValue("connection");
  -        String connectionValue = 
  -            connectionValueMB.toString().toLowerCase().trim();
  -        // FIXME: This can be a comma separated list
  -        if (connectionValue.equals("close")) {
  -            keepAlive = false;
  -        } else if (connectionValue.equals("keep-alive")) {
  -            keepAlive = true;
  +        if (connectionValueMB != null) {
  +            String connectionValue = 
  +                connectionValueMB.toString().toLowerCase().trim();
  +            // FIXME: This can be a comma separated list
  +            if (connectionValue.equals("close")) {
  +                keepAlive = false;
  +            } else if (connectionValue.equals("keep-alive")) {
  +                keepAlive = true;
  +            }
           }
   
           // Check user-agent header
  @@ -503,7 +510,25 @@
   
           contentDelimitation = false;
   
  +        OutputFilter[] outputFilters = outputBuffer.getFilters();
  +
  +        outputBuffer.addActiveFilter
  +            (outputFilters[Constants.IDENTITY_FILTER]);
  +
  +        int contentLength = request.getContentLength();
  +        if (contentLength != -1) {
  +            contentDelimitation = true;
  +        }
  +
  +        // Build the response header
  +        outputBuffer.sendStatus();
   
  +        MimeHeaders headers = response.getMimeHeaders();
  +        int size = headers.size();
  +        for (int i = 0; i < size; i++) {
  +            outputBuffer.sendHeader(headers.getName(i), headers.getValue(i));
  +        }
  +        outputBuffer.endHeaders();
   
           if (!contentDelimitation) {
               // Mark as close the connection after the request, and add the 
  
  
  
  1.4       +7 -4      jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java
  
  Index: InternalInputBuffer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InternalInputBuffer.java	4 Dec 2001 06:33:06 -0000	1.3
  +++ InternalInputBuffer.java	1 Jan 2002 21:34:01 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java,v
1.3 2001/12/04 06:33:06 remm Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/12/04 06:33:06 $
  + * $Header: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalInputBuffer.java,v
1.4 2002/01/01 21:34:01 remm Exp $
  + * $Revision: 1.4 $
  + * $Date: 2002/01/01 21:34:01 $
    *
    * ====================================================================
    *
  @@ -683,7 +683,10 @@
       public int doRead(ByteChunk chunk) 
           throws IOException {
   
  -        return activeFilters[lastActiveFilter].doRead(chunk);
  +        if (lastActiveFilter == -1)
  +            return inputStreamInputBuffer.doRead(chunk);
  +        else
  +            return activeFilters[lastActiveFilter].doRead(chunk);
   
       }
   
  
  
  
  1.6       +9 -4      jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalOutputBuffer.java
  
  Index: InternalOutputBuffer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11/InternalOutputBuffer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- InternalOutputBuffer.java	9 Dec 2001 22:10:47 -0000	1.5
  +++ InternalOutputBuffer.java	1 Jan 2002 21:34:01 -0000	1.6
  @@ -109,6 +109,7 @@
   
           filterLibrary = new OutputFilter[0];
           activeFilters = new OutputFilter[0];
  +        lastActiveFilter = -1;
   
           committed = false;
   
  @@ -343,9 +344,8 @@
   
           }
   
  -        for (int i = lastActiveFilter; i >= 0; i--) {
  -            activeFilters[i].end();
  -        }
  +        if (lastActiveFilter != -1)
  +            activeFilters[lastActiveFilter].end();
   
       }
   
  @@ -377,6 +377,8 @@
   	    write(status);
   	}
   
  +        write(" ");
  +
           // Write message
           write(HttpMessages.getMessage(status));
   
  @@ -466,7 +468,10 @@
   
           }
   
  -        return activeFilters[lastActiveFilter].doWrite(chunk);
  +        if (lastActiveFilter == -1)
  +            return outputStreamOutputBuffer.doWrite(chunk);
  +        else
  +            return activeFilters[lastActiveFilter].doWrite(chunk);
   
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message