]> granicus.if.org Git - apache/commitdiff
Apply changes to ap_get_brigade() to the proxy code.
authorGraham Leggett <minfrin@apache.org>
Mon, 23 Apr 2001 21:03:39 +0000 (21:03 +0000)
committerGraham Leggett <minfrin@apache.org>
Mon, 23 Apr 2001 21:03:39 +0000 (21:03 +0000)
PR:
Obtained from:
Reviewed by:

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

modules/proxy/proxy_ftp.c
modules/proxy/proxy_http.c
modules/proxy/proxy_util.c

index 39a2283bf06c25ba4fdf4d0f2b712b92206cde2b..d61e80c355340be033219d41cdb11e71df8e02e6 100644 (file)
@@ -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);
index 17cb09cd9513255bb031bc124bb800c3afa499e4..a623cdd9bb1f6fd17ad4c882069d23724e3cf5a4 100644 (file)
@@ -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);
index f7c173eebc37de64f090037a7086e46f4acb5c16..17cef14e85c8e423972a660345aba89902abc5c2 100644 (file)
@@ -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;
        }