httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Temme <scte...@apache.org>
Subject Re: ap_get_server_port differences
Date Sat, 12 Nov 2005 17:49:50 GMT

On Nov 11, 2005, at 12:33 PM, Brian Akins wrote:

> in 2.1.9 ap_get_server_port uses the following:
>
>  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);
>
>
> in 2.0.55 it uses:
>
>  port = r->parsed_uri.port_str ? r->parsed_uri.port :
>                r->server->port ? r->server->port :
>                ap_default_port(r);
>
>
> This just bit me bad!  I was used to being able to declare things  
> like:

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.

> ServerName www.domain.com:80
>
> and having redirects (mod_dir, etc) to pick up on this via  
> ap_construct_url
>
>
> What, if any, is the work around for 2.1.9?  I really don't want to  
> use "UseCanonicalName On"

Did you force it to 'Off' in 2.0? If you have it 'Off', you believe  
what the client sends you, or what you explicitly stashed in the  
server record by specifying it in the ServerName directive. In the  
newer server, we added the actual port the request came in on, which  
should match the information in the server_rec...

In the other case, UseCanonicalName On which was default in the 2.0  
branch, we look first in the server_rec and then in the connection.  
You could possibly make a case for having the search order in the top  
of the if clause match the one in the bottom. This against trunk:

===================================================================
--- server/core.c       (revision 332799)
+++ server/core.c       (working copy)
@@ -960,8 +960,8 @@
           * any are supplied (otherwise it will use the canonical  
name).
           */
          port = r->parsed_uri.port_str ? r->parsed_uri.port :
+               r->server->port ? r->server->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 */

That would probably better align with the principle of least  
astonishment.

S.

-- 
sander@temme.net              http://www.temme.net/sander/
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF


Mime
View raw message