httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/modules/http http_protocol.c
Date Sat, 27 Jan 2001 18:23:50 GMT
rbb         01/01/27 10:23:49

  Modified:    modules/http http_protocol.c
  Log:
  Fix a seg fault.  The problem is easy to explain.  On a HEAD request, Good
  handlers will send their data down the filter stack, but 1.3 handlers will
  just return, giving us a Content-Length of 0.  Since we can't send a C-L
  of 0 just because it is a HEAD request, we search the headers_out table
  for a 0 C-L if it is a HEAD request.  The problem is that some filters
  will not allow (includes_filter) a C-L to be computed, so we end up without
  a C-L header in headers_out.  Thus, when we do a strcmp against the header
  value and "0", we seg fault, because the header value is NULL.
  
  To fix this, we grab the element from the header table, and make sure it
  isn't NULL before doing the strcmp.
  
  Revision  Changes    Path
  1.285     +3 -1      httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.284
  retrieving revision 1.285
  diff -u -d -b -w -u -r1.284 -r1.285
  --- http_protocol.c	2001/01/27 17:17:50	1.284
  +++ http_protocol.c	2001/01/27 18:23:49	1.285
  @@ -2448,6 +2448,7 @@
       char *date = NULL;
       request_rec *r = f->r;
       char *buff, *buff_start;
  +    const char *clheader;
       const char *protocol;
       apr_bucket *e;
       apr_bucket_brigade *b2;
  @@ -2560,7 +2561,8 @@
        * 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")) {
  +        (clheader = apr_table_get(r->headers_out, "Content-Length")) &&
  +        !strcmp(clheader, "0")) {
           apr_table_unset(r->headers_out, "Content-Length");
       }
   
  
  
  

Mime
View raw message