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 Http11Processor.java
Date Sat, 09 Nov 2002 17:12:17 GMT
remm        2002/11/09 09:12:17

  Modified:    http11/src/java/org/apache/coyote/http11
                        Http11Processor.java
  Log:
  - Refactor special header handling.
  - The special headers are now set in the protocol handler, which allows enforcing
    the protocol (as it is not possible to remove headers from the MimeHeaders).
  - This may not be compatible with Coyote JK 2. Please review.
  
  Revision  Changes    Path
  1.43      +20 -2     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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- Http11Processor.java	25 Oct 2002 14:00:35 -0000	1.42
  +++ Http11Processor.java	9 Nov 2002 17:12:17 -0000	1.43
  @@ -866,6 +866,7 @@
               outputBuffer.addActiveFilter
                   (outputFilters[Constants.VOID_FILTER]);
               entityBody = false;
  +            contentDelimitation = true;
           }
   
           MessageBytes methodMB = request.method();
  @@ -873,10 +874,28 @@
               // No entity body
               outputBuffer.addActiveFilter
                   (outputFilters[Constants.VOID_FILTER]);
  +            contentDelimitation = true;
  +        }
  +
  +        MimeHeaders headers = response.getMimeHeaders();
  +        if (!entityBody) {
  +            response.setContentLength(-1);
  +        } else {
  +            String contentType = response.getContentType();
  +            if (contentType != null) {
  +                headers.setValue("Content-Type").setString(contentType);
  +            }
  +            String contentLanguage = response.getContentLanguage();
  +            if (contentLanguage != null) {
  +                headers.setValue("Content-Language")
  +                    .setString(contentLanguage);
  +            }
           }
   
           int contentLength = response.getContentLength();
           if (contentLength != -1) {
  +            response.getMimeHeaders().setValue("Content-Length")
  +                .setInt(contentLength);
               outputBuffer.addActiveFilter
                   (outputFilters[Constants.IDENTITY_FILTER]);
               contentDelimitation = true;
  @@ -907,14 +926,13 @@
   
           if (!keepAlive) {
               response.addHeader("Connection", "close");
  -        } else if(!http11) {
  +        } else if (!http11) {
               response.addHeader("Connection", "Keep-Alive");
           }
   
           // 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));
  
  
  

--
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