From: Graham Leggett Date: Mon, 23 Apr 2001 21:03:39 +0000 (+0000) Subject: Apply changes to ap_get_brigade() to the proxy code. X-Git-Tag: 2.0.18~174 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83e42d21571352d1211551236c7b5a933b929f04;p=apache Apply changes to ap_get_brigade() to the proxy code. PR: Obtained from: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88922 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 39a2283bf0..d61e80c355 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -1561,9 +1561,6 @@ PROXY_DECLARE (int) ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf /* send response */ r->sent_bodyct = 1; - /* read till EOF */ - c->remain = -1; - if (parms[0] == 'd') { /* insert directory filter */ ap_add_output_filter("PROXY_SEND_DIR", NULL, r, r->connection); @@ -1576,7 +1573,7 @@ PROXY_DECLARE (int) ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf "proxy: FTP: start body send"); /* read the body, pass it to the output filters */ - while (ap_get_brigade(remote->input_filters, bb, AP_MODE_BLOCKING) == APR_SUCCESS) { + while (ap_get_brigade(remote->input_filters, bb, AP_MODE_BLOCKING, -1) == APR_SUCCESS) { if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { e = apr_bucket_flush_create(); APR_BRIGADE_INSERT_TAIL(bb, e); diff --git a/modules/proxy/proxy_http.c b/modules/proxy/proxy_http.c index 17cb09cd95..a623cdd9bb 100644 --- a/modules/proxy/proxy_http.c +++ b/modules/proxy/proxy_http.c @@ -744,6 +744,7 @@ PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *con /* send body */ if (!r->header_only) { const char *buf; + apr_size_t remain; /* if chunked - insert DECHUNK filter */ if (ap_proxy_liststr((buf = apr_table_get(r->headers_out, "Transfer-Encoding")), "chunked")) { @@ -753,11 +754,12 @@ PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *con apr_table_set(r->headers_out, "Transfer-Encoding", buf); } ap_add_input_filter("DECHUNK", NULL, rp, origin); + remain = -1; } /* if content length - set the length to read */ else if ((buf = apr_table_get(r->headers_out, "Content-Length"))) { - origin->remain = atol(buf); + remain = atol(buf); } /* no chunked / no length therefore read till EOF and cancel keepalive */ @@ -767,14 +769,14 @@ PROXY_DECLARE (int) ap_proxy_http_handler(request_rec *r, proxy_server_conf *con /* if keepalive cancelled, read to EOF */ if (close) { - origin->remain = -1; + remain = -1; } ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r->server, "proxy: start body send"); /* read the body, pass it to the output filters */ - while (ap_get_brigade(rp->input_filters, bb, AP_MODE_BLOCKING) == APR_SUCCESS) { + while (ap_get_brigade(rp->input_filters, bb, AP_MODE_BLOCKING, remain) == APR_SUCCESS) { if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { e = apr_bucket_flush_create(); APR_BRIGADE_INSERT_TAIL(bb, e); diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index f7c173eebc..17cef14e85 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -1096,14 +1096,11 @@ apr_status_t ap_proxy_string_read(conn_rec *c, apr_bucket_brigade *bb, buff[0] = 0; *eos = 0; - /* get line-at-a-time */ - c->remain = 0; - /* loop through each brigade */ while (!found) { - /* get brigade from network */ - if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING))) { + /* get brigade from network one line at a time */ + if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, AP_MODE_BLOCKING, 0))) { return rv; }