]> granicus.if.org Git - apache/commitdiff
When no port is given in a "ServerName host" directive, the
authorMartin Kraemer <martin@apache.org>
Thu, 8 Nov 2001 12:34:21 +0000 (12:34 +0000)
committerMartin Kraemer <martin@apache.org>
Thu, 8 Nov 2001 12:34:21 +0000 (12:34 +0000)
server_rec->port is now set to zero, not 80. That allows for
run-time deduction of the correct server port (depending on
SSL/plain, and depending also on the current setting of
UseCanonicalName). This change makes redirections
work, even with https:// connections. [Martin Kraemer]

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

CHANGES
server/core.c

diff --git a/CHANGES b/CHANGES
index 4cb6adbaa505f78046366dbe94dd84a905c61308..c40c621198d252be9f3fc2ff70b673f1b741d446 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,12 @@
 Changes with Apache 2.0.28-dev
 
+  *) When no port is given in a "ServerName host" directive, the
+     server_rec->port is now set to zero, not 80. That allows for
+     run-time deduction of the correct server port (depending on
+     SSL/plain, and depending also on the current setting of
+     UseCanonicalName). This change makes redirections
+     work, even with https:// connections. [Martin Kraemer]
+
   *) Add a '%{note-name}e' argument to mod-headers, which works in
      the same way as mod_log_confg.  [Ian Holsman]
 
index 88251f6ab4d86c6080f17e5b601043bbfe2f0939..175c0ec1ce3961ed0e5ee862d04cc6c7903c9ad8 100644 (file)
@@ -756,7 +756,7 @@ AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r)
 
     if (d->use_canonical_name == USE_CANONICAL_NAME_OFF
        || d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
-        if (r->hostname) {
+        if (r->connection && r->connection->client_socket) {
             apr_sockaddr_t *localsa;
 
             apr_socket_addr_get(&localsa, APR_LOCAL, r->connection->client_socket);
@@ -1633,15 +1633,15 @@ static const char *server_hostname_port(cmd_parms *cmd, void *dummy, const char
                                                     portstr - arg);
         portstr++;
         port = atoi(portstr);
+        if (port <= 0 || port >= 65536) { /* 65536 == 1<<16 */
+            return apr_pstrcat(cmd->temp_pool, "The port number \"", arg, 
+                         "\" is outside the appropriate range "
+                         "(i.e., 1..65535).", NULL);
+        }
     }
     else {
         cmd->server->server_hostname = apr_pstrdup(cmd->pool, arg);
-        port = 80;
-    }
-    if (port <= 0 || port >= 65536) { /* 65536 == 1<<16 */
-       return apr_pstrcat(cmd->temp_pool, "The port number \"", arg, 
-                         "\" is outside the appropriate range "
-                         "(i.e., 1..65535).", NULL);
+        port = 0;
     }
     cmd->server->port = port;
     return NULL;