You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2006/02/11 21:57:14 UTC

svn commit: r377053 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Author: rpluem
Date: Sat Feb 11 12:57:12 2006
New Revision: 377053

URL: http://svn.apache.org/viewcvs?rev=377053&view=rev
Log:
* Do not remove the connection headers from r->headers_in. They are needed
  by the http output filter to create the correct connection response headers.
  Instead work on a copy of r->headers_in.

PR: 38524

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_http.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/proxy/mod_proxy_http.c?rev=377053&r1=377052&r2=377053&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_http.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_http.c Sat Feb 11 12:57:12 2006
@@ -595,6 +595,7 @@
     apr_off_t bytes_read = 0;
     apr_off_t bytes;
     int force10;
+    apr_table_t *headers_in_copy;
 
     header_brigade = apr_brigade_create(p, origin->bucket_alloc);
 
@@ -611,13 +612,7 @@
     if (ap_proxy_liststr(apr_table_get(r->headers_in,
                          "Connection"), "close")) {
         p_conn->close++;
-        /* XXX: we are abusing r->headers_in rather than a copy,
-         * give the core output handler a clue the client would
-         * rather just close.
-         */
-        c->keepalive = AP_CONN_CLOSE;
     }
-    ap_proxy_clear_connection(p, r->headers_in);
 
     if (apr_table_get(r->subprocess_env, "force-proxy-request-1.0")) {
         buf = apr_pstrcat(p, r->method, " ", url, " HTTP/1.0" CRLF, NULL);
@@ -736,9 +731,16 @@
                          r->server->server_hostname);
     }
 
-    /* send request headers */
     proxy_run_fixups(r);
-    headers_in_array = apr_table_elts(r->headers_in);
+    /*
+     * Make a copy of the headers_in table before clearing the connection
+     * headers as we need the connection headers later in the http output
+     * filter to prepare the correct response headers.
+     */
+    headers_in_copy = apr_table_copy(p, r->headers_in);
+    ap_proxy_clear_connection(p, headers_in_copy);
+    /* send request headers */
+    headers_in_array = apr_table_elts(headers_in_copy);
     headers_in = (const apr_table_entry_t *) headers_in_array->elts;
     for (counter = 0; counter < headers_in_array->nelts; counter++) {
         if (headers_in[counter].key == NULL



Re: svn commit: r377053 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Posted by Joe Orton <jo...@redhat.com>.
On Tue, Feb 14, 2006 at 12:02:24AM +0100, Ruediger Pluem wrote:
> On 02/13/2006 04:37 PM, Joe Orton wrote:
> > On Sat, Feb 11, 2006 at 08:57:14PM -0000, rpluem@apache.org wrote:
> > This change (I think) is triggering the bad pool ancestry abort() in the 
> > tables code: the proxy tests in the test suite are all dumping core in 
> > APR_POOL_DEBUG builds since yesterday.  Here's a sample backtrace:
> 
> Thanks for spotting this. You are correct: I used the wrong pool.
> p is actually the connection pool whereas the key / value pairs in r->headers_in
> get created from r->pool which lives shorter than the connection pool.
> Hopefully fixed by r377525.
> Could you please give it a try again?

Great, thanks, that fixed all the proxy failures.

joe

Re: svn commit: r377053 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 02/13/2006 04:37 PM, Joe Orton wrote:
> On Sat, Feb 11, 2006 at 08:57:14PM -0000, rpluem@apache.org wrote:
> 
> 
> 
> This change (I think) is triggering the bad pool ancestry abort() in the 
> tables code: the proxy tests in the test suite are all dumping core in 
> APR_POOL_DEBUG builds since yesterday.  Here's a sample backtrace:

Thanks for spotting this. You are correct: I used the wrong pool.
p is actually the connection pool whereas the key / value pairs in r->headers_in
get created from r->pool which lives shorter than the connection pool.
Hopefully fixed by r377525.
Could you please give it a try again?

Regards

RĂ¼diger


Re: svn commit: r377053 - /httpd/httpd/trunk/modules/proxy/mod_proxy_http.c

Posted by Joe Orton <jo...@redhat.com>.
On Sat, Feb 11, 2006 at 08:57:14PM -0000, rpluem@apache.org wrote:
> Author: rpluem
> Date: Sat Feb 11 12:57:12 2006
> New Revision: 377053
> 
> URL: http://svn.apache.org/viewcvs?rev=377053&view=rev
> Log:
> * Do not remove the connection headers from r->headers_in. They are needed
>   by the http output filter to create the correct connection response headers.
>   Instead work on a copy of r->headers_in.
> 
> PR: 38524

This change (I think) is triggering the bad pool ancestry abort() in the 
tables code: the proxy tests in the test suite are all dumping core in 
APR_POOL_DEBUG builds since yesterday.  Here's a sample backtrace:

#0  0x0000002a96514745 in raise () from /lib64/tls/libc.so.6
No symbol table info available.
#1  0x0000002a96515eb3 in abort () from /lib64/tls/libc.so.6
No symbol table info available.
#2  0x0000002a95e629e4 in apr_table_copy (p=0x6c8980, t=0x6c54d0)
    at tables/apr_tables.c:403
	new = (apr_table_t *) 0x79f960
#3  0x0000002a9a735b05 in ap_proxy_http_request (p=0x6c8980, r=0x6f1e70, 
    p_conn=0x705ca0, origin=0x6d2e80, conf=0x6a6ff0, uri=0x0, 
    url=0x6edce0 "/", server_portstr=0x7fbfff7940 ":8541")
    at mod_proxy_http.c:729
	here = (struct apr_bucket *) 0x6
	c = (conn_rec *) 0x6c4e20
	bucket_alloc = (apr_bucket_alloc_t *) 0x834d08
	header_brigade = (apr_bucket_brigade *) 0x6dc840
	input_brigade = (apr_bucket_brigade *) 0x2a9a737e2c
	temp_brigade = (apr_bucket_brigade *) 0x6ffc40
	e = (apr_bucket *) 0xffffffffffffffff
	buf = 0x633ed0 "Host: localhost.localdomain:8529\r\n"
	headers_in_array = (const apr_array_header_t *) 0x43a203
	headers_in = (const apr_table_entry_t *) 0x677ef0
	counter = 0
	status = 6504144
	rb_method = RB_INIT
	old_cl_val = 0x0
	old_te_val = 0x0
	bytes_read = 0
	bytes = 6229376
	force10 = 0
	headers_in_copy = (apr_table_t *) 0x633ed0
...