httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <rpl...@apache.org>
Subject Re: ap_get_server_port differences
Date Sun, 13 Nov 2005 11:49:05 GMT


On 11/12/2005 06:46 PM, Sander Temme wrote:

[..cut..]

> 
> What bit you is probably the change in default value for 
> UseCanonicalName? Used to be On by default, now it's Off. Try  flicking
> that switch.

I saw that it is now set to off in the default configuration files, but the
behaviour of the code confuses me if it is not set at all in the configuration.
In this case use_canonical_name is set to USE_CANONICAL_NAME_UNSET, but:

In ap_get_server_name the behaviour in this case is like OFF and

    if (d->use_canonical_name == USE_CANONICAL_NAME_ON) {
        return r->server->server_hostname;
    }

    if (d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
        if (conn->local_host == NULL) {
            if (apr_getnameinfo(&conn->local_host,
                                conn->local_addr, 0) != APR_SUCCESS)
                conn->local_host = apr_pstrdup(conn->pool,
                                               r->server->server_hostname);
            else {
                ap_str_tolower(conn->local_host);
            }
        }

        return conn->local_host;
    }

in ap_get_server_port it is like ON:


   if (d->use_canonical_name == USE_CANONICAL_NAME_OFF
        || d->use_canonical_name == USE_CANONICAL_NAME_DNS) {

        /* With UseCanonicalName off Apache will form self-referential
         * URLs using the hostname and port supplied by the client if
         * any are supplied (otherwise it will use the canonical name).
         */
        port = r->parsed_uri.port_str ? r->parsed_uri.port :
               r->connection->local_addr->port ? r->connection->local_addr->port
:
               r->server->port ? r->server->port :
               ap_default_port(r);
    }
    else { /* d->use_canonical_name == USE_CANONICAL_NAME_ON */

Is this correct?


Regards

RĂ¼diger

[..cut..]

Mime
View raw message