]> granicus.if.org Git - apache/commitdiff
Teach mod_proxy to live with the new filtering scheme.
authorJustin Erenkrantz <jerenkrantz@apache.org>
Thu, 11 Oct 2001 20:03:26 +0000 (20:03 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Thu, 11 Oct 2001 20:03:26 +0000 (20:03 +0000)
Tested with www.yahoo.com (Conn: Close), www.apache.org (CL), and
www.apple.com (TE: Chunked).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91436 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/proxy/proxy_http.c

diff --git a/CHANGES b/CHANGES
index 1ba26c94b4a6cb3d23906bb07f809c82f5364873..23210ab1e730709e04ab6262d3cb41f77573a807 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
 Changes with Apache 2.0.26-dev
 
+  *) Fix mod_proxy so that it handles chunked transfer-encoding and works
+     with the new input filtering system.  [Justin Erenkrantz]
+
   *) Introduce the MultiviewsMatch directive, to allow the operator
      to be flexible in recognizing Handlers and Filters filename
      extensions as part of the Multiviews matching logic, strict with
index ebd6305ce43adb2731c2498567b28c1394f1dcf9..ff89a326781b0995c736407e542d6332df1a36c4 100644 (file)
@@ -793,27 +793,26 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
             (r->status != HTTP_NOT_MODIFIED)) {        /* not 304 */
 
             const char *buf;
-            apr_off_t readbytes;
             if (ap_proxy_liststr((buf = apr_table_get(r->headers_out,
                                   "Transfer-Encoding")), "chunked")) {
             ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
                          "proxy: Transfer-Encoding Chunked!");
                 apr_table_unset(r->headers_out,"Content-Length");
             }
-            /* if keepalive cancelled, read to EOF */
-            if (p_conn->close) {
-                readbytes = -1;
-            }
 
             ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,
                          "proxy: start body send");
-    
+             
             /*
              * if we are overriding the errors, we cant put the content of the
              * page into the brigade
              */
             if ( (conf->error_override ==0) || r->status < 400 ) {
             /* read the body, pass it to the output filters */
+                apr_off_t readbytes;
+                apr_bucket *e;
+                rp->headers_in = r->headers_out;
+                readbytes = 8192;
                 while (ap_get_brigade(rp->input_filters, 
                                        bb, 
                                       AP_MODE_NONBLOCKING, 
@@ -823,17 +822,22 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
                                  r->server, "proxy (PID %d): readbytes: %#x",
                                  getpid(), readbytes);
 #endif
-
+                    if (APR_BRIGADE_EMPTY(bb)) {
+                        break;
+                    }
                     if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
                         ap_pass_brigade(r->output_filters, bb);
                                break;
                     }
+                    e = apr_bucket_flush_create();
+                    APR_BRIGADE_INSERT_TAIL(bb, e);
                     if (ap_pass_brigade(r->output_filters, bb) != APR_SUCCESS) {
                         /* Ack! Phbtt! Die! User aborted! */
                         p_conn->close = 1;  /* this causes socket close below */
                         break;
                     }
                     apr_brigade_cleanup(bb);
+                    readbytes = 8192;
                 }
             }
             ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server,