From: Justin Erenkrantz Date: Thu, 11 Oct 2001 20:03:26 +0000 (+0000) Subject: Teach mod_proxy to live with the new filtering scheme. X-Git-Tag: 2.0.26~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22c9145d8d32ca077d09b8ef78374fd063a093d6;p=apache Teach mod_proxy to live with the new filtering scheme. 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 --- diff --git a/CHANGES b/CHANGES index 1ba26c94b4..23210ab1e7 100644 --- 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 diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index ebd6305ce4..ff89a32678 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -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,