]> granicus.if.org Git - apache/commitdiff
When sending a proxy request of the form
authorMartin Kraemer <martin@apache.org>
Fri, 29 Feb 2008 12:15:56 +0000 (12:15 +0000)
committerMartin Kraemer <martin@apache.org>
Fri, 29 Feb 2008 12:15:56 +0000 (12:15 +0000)
  GET http://[3ffe:1:1001:3000:230:5ff:fe05:3c3c]/server-status HTTP/1.0
through the httpd-2.x mod_proxy.c code, while a directive
  ProxyDomain .my.dom.ain
is in effect, the request is redirected to
  Location: http://[3ffe:1:1001:3000:230:5ff:fe05:3c3c.my.dom.ain]/server-status

The patch fixes this bug, by testing whether the hostname part of the
unparsed_uri contains colon characters (which is the case only for
IPv6 literals).

This patch is also a candidate for httpd-2.0 and httpd-2.2

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

modules/proxy/mod_proxy.c

index 97d53b604e84b5d62b87cfccdf786b3866456106..45e07681f5659faf28a3a85d043e57498e5a03ae 100644 (file)
@@ -737,7 +737,8 @@ static int proxy_needsdomain(request_rec *r, const char *url, const char *domain
         return DECLINED;
 
     /* If host does contain a dot already, or it is "localhost", decline */
-    if (strchr(r->parsed_uri.hostname, '.') != NULL
+    if (strchr(r->parsed_uri.hostname, '.') != NULL /* has domain, or IPv4 literal */
+     || strchr(r->parsed_uri.hostname, ':') != NULL /* IPv6 literal */
      || strcasecmp(r->parsed_uri.hostname, "localhost") == 0)
         return DECLINED;    /* host name has a dot already */