]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r778531 from trunk:
authorJim Jagielski <jim@apache.org>
Fri, 10 Jul 2009 12:22:21 +0000 (12:22 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 10 Jul 2009 12:22:21 +0000 (12:22 +0000)
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

CHANGES
STATUS
modules/proxy/mod_proxy_http.c

diff --git a/CHANGES b/CHANGES
index 04c19eec979498f6d87553845c50e35773ede6c0..f96dcfc12239b1e55b8ba4513a5bae76bbb781c9 100644 (file)
--- 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 <cgbraschi gmail.com>]
+
   *) mod_rewrite: Remove locking for writing to the rewritelog.
      PR 46942
 
diff --git a/STATUS b/STATUS
index 6141d32f78c2697a9a7e52269786ffb714a2b950..ff09d4098ff9ac3c956de314fb309a3c5e493de0 100644 (file)
--- 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 ]
index caa7e5c54278bd6090c4203639f30c9343d8f071..3401526304072a4df25a1a0cf2ecf5fd1fb4c1f5 100644 (file)
@@ -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 {