Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 20577 invoked from network); 8 Aug 2005 03:33:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Aug 2005 03:33:26 -0000 Received: (qmail 71277 invoked by uid 500); 8 Aug 2005 03:33:25 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 71259 invoked by uid 500); 8 Aug 2005 03:33:25 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 71245 invoked by uid 99); 8 Aug 2005 03:33:25 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 07 Aug 2005 20:33:24 -0700 Received: (qmail 20555 invoked by uid 65534); 8 Aug 2005 03:33:24 -0000 Message-ID: <20050808033324.20554.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r230744 - /httpd/httpd/branches/proxy-reqbody-2.0.x/modules/proxy/proxy_http.c Date: Mon, 08 Aug 2005 03:33:24 -0000 To: cvs@httpd.apache.org From: wrowe@apache.org X-Mailer: svnmailer-1.0.3 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: wrowe Date: Sun Aug 7 20:33:20 2005 New Revision: 230744 URL: http://svn.apache.org/viewcvs?rev=230744&view=rev Log: The final, inconsequential patch which makes the diff for request body processing between trunk/ and 2.1.x/ very easy to read. This patch consists of nothing except whitespace changes, and the change from b to bb for the local bucket brigade variable name, to disambiguate it from a bucket. Modified: httpd/httpd/branches/proxy-reqbody-2.0.x/modules/proxy/proxy_http.c Modified: httpd/httpd/branches/proxy-reqbody-2.0.x/modules/proxy/proxy_http.c URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/proxy-reqbody-2.0.x/modules/proxy/proxy_http.c?rev=230744&r1=230743&r2=230744&view=diff ============================================================================== --- httpd/httpd/branches/proxy-reqbody-2.0.x/modules/proxy/proxy_http.c (original) +++ httpd/httpd/branches/proxy-reqbody-2.0.x/modules/proxy/proxy_http.c Sun Aug 7 20:33:20 2005 @@ -431,23 +431,23 @@ static apr_status_t pass_brigade(apr_bucket_alloc_t *bucket_alloc, request_rec *r, proxy_http_conn_t *p_conn, - conn_rec *origin, apr_bucket_brigade *b, + conn_rec *origin, apr_bucket_brigade *bb, int flush) { apr_status_t status; if (flush) { apr_bucket *e = apr_bucket_flush_create(bucket_alloc); - APR_BRIGADE_INSERT_TAIL(b, e); + APR_BRIGADE_INSERT_TAIL(bb, e); } - status = ap_pass_brigade(origin->output_filters, b); + status = ap_pass_brigade(origin->output_filters, bb); if (status != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, status, r->server, "proxy: pass request body failed to %pI (%s)", p_conn->addr, p_conn->name); return status; } - apr_brigade_cleanup(b); + apr_brigade_cleanup(bb); return APR_SUCCESS; } @@ -463,7 +463,7 @@ apr_off_t bytes; apr_status_t status; apr_bucket_alloc_t *bucket_alloc = r->connection->bucket_alloc; - apr_bucket_brigade *b; + apr_bucket_brigade *bb; apr_bucket *e; add_te_chunked(p, bucket_alloc, header_brigade); @@ -476,6 +476,7 @@ /* If this brigade contains EOS, either stop or remove it. */ if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(input_brigade))) { seen_eos = 1; + /* We can't pass this EOS to the output_filters. */ e = APR_BRIGADE_LAST(input_brigade); apr_bucket_delete(e); @@ -502,15 +503,16 @@ /* we never sent the header brigade, so go ahead and * take care of that now */ - b = header_brigade; - APR_BRIGADE_CONCAT(b, input_brigade); + bb = header_brigade; + APR_BRIGADE_CONCAT(bb, input_brigade); header_brigade = NULL; } else { - b = input_brigade; + bb = input_brigade; } - status = pass_brigade(bucket_alloc, r, p_conn, origin, b, 0); + /* The request is flushed below this loop with chunk EOS header */ + status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 0); if (status != APR_SUCCESS) { return status; } @@ -532,7 +534,7 @@ /* we never sent the header brigade because there was no request body; * send it now */ - b = header_brigade; + bb = header_brigade; } else { if (!APR_BRIGADE_EMPTY(input_brigade)) { @@ -541,16 +543,17 @@ AP_DEBUG_ASSERT(APR_BUCKET_IS_EOS(e)); apr_bucket_delete(e); } - b = input_brigade; + bb = input_brigade; } e = apr_bucket_immortal_create(ASCII_ZERO ASCII_CRLF /* */ ASCII_CRLF, 5, bucket_alloc); - APR_BRIGADE_INSERT_TAIL(b, e); - - status = pass_brigade(bucket_alloc, r, p_conn, origin, b, 1); + APR_BRIGADE_INSERT_TAIL(bb, e); + + /* Now we have headers-only, or the chunk EOS mark; flush it */ + status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1); return status; } @@ -565,7 +568,7 @@ int seen_eos = 0; apr_status_t status; apr_bucket_alloc_t *bucket_alloc = r->connection->bucket_alloc; - apr_bucket_brigade *b; + apr_bucket_brigade *bb; apr_bucket *e; apr_off_t cl_val = 0; apr_off_t bytes; @@ -607,16 +610,16 @@ /* we never sent the header brigade, so go ahead and * take care of that now */ - b = header_brigade; - APR_BRIGADE_CONCAT(b, input_brigade); + bb = header_brigade; + APR_BRIGADE_CONCAT(bb, input_brigade); header_brigade = NULL; } else { - b = input_brigade; + bb = input_brigade; } /* Once we hit EOS, we are ready to flush. */ - status = pass_brigade(bucket_alloc, r, p_conn, origin, b, seen_eos); + status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, seen_eos); if (status != APR_SUCCESS) { return status; } @@ -633,7 +636,7 @@ return status; } } - + if (bytes_streamed != cl_val) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, "proxy: client %s given Content-Length did not match" @@ -645,8 +648,8 @@ /* we never sent the header brigade since there was no request * body; send it now with the flush flag */ - b = header_brigade; - status = pass_brigade(bucket_alloc, r, p_conn, origin, b, 1); + bb = header_brigade; + status = pass_brigade(bucket_alloc, r, p_conn, origin, bb, 1); } return status; } @@ -797,8 +800,8 @@ apr_bucket_alloc_t *bucket_alloc = c->bucket_alloc; apr_bucket_brigade *input_brigade; apr_bucket_brigade *temp_brigade; - char *buf; apr_bucket *e; + char *buf; const apr_array_header_t *headers_in_array; const apr_table_entry_t *headers_in; int counter; @@ -818,8 +821,8 @@ /* strip connection listed hop-by-hop headers from the request */ /* even though in theory a connection: close coming from the client * should not affect the connection to the server, it's unlikely - * that subsequent client requests will hit this thread/process, so - * we cancel server keepalive if the client does. + * that subsequent client requests will hit this thread/process, + * so we cancel server keepalive if the client does. */ if (ap_proxy_liststr(apr_table_get(r->headers_in, "Connection"), "close")) { @@ -924,7 +927,7 @@ * determine, where the original request came from. */ apr_table_mergen(r->headers_in, "X-Forwarded-For", - r->connection->remote_ip); + r->connection->remote_ip); /* Add X-Forwarded-Host: so that upstream knows what the * original request hostname was. @@ -938,7 +941,7 @@ * XXX: This duplicates Via: - do we strictly need it? */ apr_table_mergen(r->headers_in, "X-Forwarded-Server", - r->server->server_hostname); + r->server->server_hostname); } /* send request headers */ @@ -948,7 +951,7 @@ for (counter = 0; counter < headers_in_array->nelts; counter++) { if (headers_in[counter].key == NULL || headers_in[counter].val == NULL - + /* Already sent */ || !strcasecmp(headers_in[counter].key, "Host") @@ -1008,7 +1011,7 @@ input_brigade = apr_brigade_create(p, bucket_alloc); /* sub-requests never use keepalives, and mustn't pass request bodies. - * Because the new logic looks at input_brigade, we must self-terminate + * Because the new logic looks at input_brigade, we will self-terminate * input_brigade and jump past all of the request body logic... * Reading anything with ap_get_brigade is likely to consume the * main request's body or read beyond EOS - which would be unplesant.