From: Jim Jagielski Date: Fri, 10 Jul 2009 12:22:21 +0000 (+0000) Subject: Merge r778531 from trunk: X-Git-Tag: 2.2.12~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ad9b384a9c6816a7df967ab6503594c20b0513ec;p=thirdparty%2Fapache%2Fhttpd.git Merge r778531 from trunk: Fix IPv6 literal addresses passed to a proxied backend. PR 47177 Patch by Carlos Garcia Braschi Submitted by: niq Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@792914 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 04c19eec979..f96dcfc1223 100644 --- a/CHANGES +++ b/CHANGES @@ -27,6 +27,9 @@ Changes with Apache 2.2.12 different security issues which may affect particular configurations and third-party modules. + *) mod_proxy_http: fix Host: header for literal IPv6 addresses. + PR 47177 [Carlos Garcia Braschi ] + *) mod_rewrite: Remove locking for writing to the rewritelog. PR 46942 diff --git a/STATUS b/STATUS index 6141d32f78c..ff09d4098ff 100644 --- a/STATUS +++ b/STATUS @@ -95,12 +95,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: http://svn.apache.org/viewvc?view=rev&revision=780699 +1: niq, rpluem, takashi - * mod_proxy_http: fix Host: header for literal IPv6 addresses. - PR 47177 - patch: http://svn.apache.org/viewvc?view=rev&revision=778531 - +1: niq, rpluem, jim - +0; [Would be +1 once ProxyRemote behavior is verified/fixed] - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index caa7e5c5427..34015263040 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -731,11 +731,20 @@ int ap_proxy_http_request(apr_pool_t *p, request_rec *r, e = apr_bucket_pool_create(buf, strlen(buf), p, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(header_brigade, e); if (conf->preserve_host == 0) { - if (uri->port_str && uri->port != DEFAULT_HTTP_PORT) { - buf = apr_pstrcat(p, "Host: ", uri->hostname, ":", uri->port_str, - CRLF, NULL); + if (ap_strchr_c(uri->hostname, ':')) { /* if literal IPv6 address */ + if (uri->port_str && uri->port != DEFAULT_HTTP_PORT) { + buf = apr_pstrcat(p, "Host: [", uri->hostname, "]:", + uri->port_str, CRLF, NULL); + } else { + buf = apr_pstrcat(p, "Host: [", uri->hostname, "]", CRLF, NULL); + } } else { - buf = apr_pstrcat(p, "Host: ", uri->hostname, CRLF, NULL); + if (uri->port_str && uri->port != DEFAULT_HTTP_PORT) { + buf = apr_pstrcat(p, "Host: ", uri->hostname, ":", + uri->port_str, CRLF, NULL); + } else { + buf = apr_pstrcat(p, "Host: ", uri->hostname, CRLF, NULL); + } } } else {