httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0/modules/proxy proxy_http.c
Date Wed, 01 Sep 2004 17:21:53 GMT
jerenkrantz    2004/09/01 10:21:53

  Modified:    .        CHANGES
               modules/proxy proxy_http.c
  Log:
  Fix a trio of bugs in how mod_proxy relays requests:
  
  - Fix type error in proxy-sendchunks case that caused an invalid T-E header.
  - Fix data corruption (seen with mod_ssl/mod_proxy combination) due to not
    properly setting aside the body_buckets.
  - Pass along a C-L: 0 if we still have a C-L of 0 after filtering and the
    original request to us had that as well.
  
  Revision  Changes    Path
  1.1580    +9 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1579
  retrieving revision 1.1580
  diff -u -u -r1.1579 -r1.1580
  --- CHANGES	1 Sep 2004 15:14:32 -0000	1.1579
  +++ CHANGES	1 Sep 2004 17:21:52 -0000	1.1580
  @@ -2,6 +2,15 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) mod_proxy: Fix type error that prevents proxy-sendchunks from working.
  +     [Justin Erenkrantz]
  +
  +  *) mod_proxy: Fix data corruption by properly setting aside buckets.
  +     [Justin Erenkrantz]
  +
  +  *) mod_proxy: If a request has a blank body and has a 0 Content-Length
  +     headers, pass that to the proxy.  [Justin Erenkrantz]
  +
     *) Fix the handling of URIs containing %2F when AllowEncodedSlashes
        is enabled.  Previously, such urls would still be rejected with
        404.  [Jeff Trawick]
  
  
  
  1.196     +26 -2     httpd-2.0/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
  retrieving revision 1.195
  retrieving revision 1.196
  diff -u -u -r1.195 -r1.196
  --- proxy_http.c	24 Aug 2004 08:24:18 -0000	1.195
  +++ proxy_http.c	1 Sep 2004 17:21:53 -0000	1.196
  @@ -467,7 +467,7 @@
   
       /* If we can send chunks, do so! */
       if (send_chunks) {
  -        const char *te_hdr = "Transfer-Encoding: chunked" CRLF;
  +        const char te_hdr[] = "Transfer-Encoding: chunked" CRLF;
   
           buf = apr_pmemdup(p, te_hdr, sizeof(te_hdr)-1);
           ap_xlate_proto_to_ascii(buf, sizeof(te_hdr)-1);
  @@ -552,6 +552,17 @@
               e = apr_bucket_immortal_create(ASCII_CRLF, 2, c->bucket_alloc);
               APR_BRIGADE_INSERT_TAIL(input_brigade, e);
           }
  +        else {
  +            /* The send_chunks case does not need to be setaside, but this
  +             * case does because we may have transient buckets that may get
  +             * overwritten in the next iteration of the loop.
  +             */
  +            e = APR_BRIGADE_FIRST(input_brigade);
  +            while (e != APR_BRIGADE_SENTINEL(input_brigade)) {
  +                apr_bucket_setaside(e, p);
  +                e = APR_BUCKET_NEXT(e);
  +            }
  +        }
   
           e = apr_bucket_flush_create(c->bucket_alloc);
           APR_BRIGADE_INSERT_TAIL(input_brigade, e);
  @@ -587,11 +598,24 @@
   
           if (bytes) {
               const char *cl_hdr = "Content-Length", *cl_val;
  -            cl_val = apr_off_t_toa(c->pool, bytes);
  +            cl_val = apr_off_t_toa(p, bytes);
               buf = apr_pstrcat(p, cl_hdr, ": ", cl_val, CRLF, NULL);
               ap_xlate_proto_to_ascii(buf, strlen(buf));
               e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc);
               APR_BUCKET_INSERT_AFTER(last_header_bucket, e);
  +        }
  +        else {
  +            /* A client might really have sent a C-L of 0.  Pass it on. */
  +            const char *cl_hdr = "Content-Length", *cl_val;
  +
  +            cl_val = apr_table_get(r->headers_in, cl_hdr);
  +            if (cl_val && cl_val[0] == '0' && cl_val[1] == 0) {
  +                buf = apr_pstrcat(p, cl_hdr, ": ", cl_val, CRLF, NULL);
  +                ap_xlate_proto_to_ascii(buf, strlen(buf));
  +                e = apr_bucket_pool_create(buf, strlen(buf), p,
  +                                           c->bucket_alloc);
  +                APR_BUCKET_INSERT_AFTER(last_header_bucket, e);
  +            }
           }
           status = ap_pass_brigade(origin->output_filters, header_brigade);
           if (status != APR_SUCCESS) {
  
  
  

Mime
View raw message