Whatever uses ap_get_server_port() would "use" the Port number included in the Host: header. This includes mod_vhost_alias, mod_proxy, mod_rewrite and Apache itself when it creates self- referential URLs (hence UseCanonicalName).

Note that it's ONLY when UseCanonicalName is Off that this is
an issue, and the SysAdmin no doubt has reasons for it :)



Index: src/main/http_vhost.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_vhost.c,v retrieving revision 1.37 diff -u -r1.37 http_vhost.c --- src/main/http_vhost.c 16 Feb 2004 22:29:33 -0000 1.37 +++ src/main/http_vhost.c 24 Mar 2004 16:14:15 -0000 @@ -662,6 +662,7 @@ char *host = ap_palloc(r->pool, strlen(r->hostname) + 1); const char *src; char *dst; + char *port_str;

     /* check and copy the host part */
     src = r->hostname;
@@ -679,6 +680,7 @@
            goto bad;
        }
         if (*src == ':') {
+            port_str = src + 1;
             /* check the port part */
             while (*++src) {
                 if (!ap_isdigit(*src)) {
@@ -687,8 +689,12 @@
             }
             if (src[-1] == ':')
                 goto bad;
-            else
+            else {
+                /* a known "good" port value */
+                r->parsed_uri.port_str = ap_pstrdup(r->pool, port_str);
+                r->parsed_uri.port = atoi(r->parsed_uri.port_str);
                 break;
+            }
         }
        *dst++ = *src++;
     }



Reply via email to