Commit c75705c5 authored by Martin Kraemer's avatar Martin Kraemer
Browse files

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]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91797 13f79535-47bb-0310-9956-ffa450edef68
parent 35066a87
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
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]

+7 −7
Original line number Diff line number Diff line
@@ -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,16 +1633,16 @@ static const char *server_hostname_port(cmd_parms *cmd, void *dummy, const char
                                                    portstr - arg);
        portstr++;
        port = atoi(portstr);
    }
    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);
        }
    }
    else {
        cmd->server->server_hostname = apr_pstrdup(cmd->pool, arg);
        port = 0;
    }
    cmd->server->port = port;
    return NULL;
}