httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_protocol.c
Date Wed, 15 Nov 2000 22:08:44 GMT
rbb         00/11/15 14:08:44

  Modified:    src      CHANGES
               src/main http_protocol.c
  Log:
  Do not send a content-length if and only if this is a HEAD request and
  the content-length is 0.  The problem is that the C-L on a HEAD response
  has to be the correct C-L, but if a handler returns saying the handled
  the request without sending data, the core sends an EOS down the filter
  stack, and we compute a 0 C-L.
  
  Revision  Changes    Path
  1.332     +2 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.331
  retrieving revision 1.332
  diff -u -r1.331 -r1.332
  --- CHANGES	2000/11/15 02:54:48	1.331
  +++ CHANGES	2000/11/15 22:08:44	1.332
  @@ -1,4 +1,6 @@
   Changes with Apache 2.0a8
  +  *) Do not send a content-length iff the C-L is 0 and this is a head
  +     request.  [Ryan Bloom]
   
     *) Make cgi-bin work as a regular directory when using mod_vhost_alias
        with no VirtualScriptAlias directives. PR#6829 [Tony Finch]
  
  
  
  1.246     +17 -0     apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.245
  retrieving revision 1.246
  diff -u -r1.245 -r1.246
  --- http_protocol.c	2000/11/14 06:41:37	1.245
  +++ http_protocol.c	2000/11/15 22:08:44	1.246
  @@ -2503,6 +2503,23 @@
           apr_table_addn(r->headers_out, "Expires", date);
       }
   
  +    /* This is a hack, but I can't find anyway around it.  The idea is that
  +     * we don't want to send out 0 Content-Lengths if it is a head request.
  +     * This happens when modules try to outsmart the server, and return
  +     * if they see a HEAD request.  Apache 1.3 handlers were supposed to
  +     * just return in that situation, and the core handled the HEAD.  In
  +     * 2.0, if a handler returns, then the core sends an EOS bucket down
  +     * the filter stack, and the content-length filter computes a C-L of
  +     * zero and that gets put in the headers, and we end up sending a 
  +     * zero C-L to the client.  We can't just remove the C-L filter,
  +     * because well behaved 2.0 handlers will send their data down the stack, 
  +     * and we will compute a real C-L for the head request. RBB
  +     */
  +    if (r->header_only && 
  +        !strcmp(apr_table_get(r->headers_out, "Content-Length"), "0")) {
  +        apr_table_unset(r->headers_out, "Content-Length");
  +    }
  +
       apr_table_do((int (*) (void *, const char *, const char *)) compute_header_len,
                    (void *) &len, r->headers_out, NULL);
       
  
  
  

Mime
View raw message