httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject cvs commit: httpd-2.0/docs/manual/mod core.html
Date Thu, 08 Nov 2001 14:29:37 GMT
martin      01/11/08 06:29:37

  Modified:    .        CHANGES
               server   core.c vhost.c
               docs/manual/mod core.html
  Log:
  Fixed previous patch to reflect what Apache-1.3 did regarding self-
  referential uri's, and updated the manual accordingly.
  XXX There is a kludge here: XXX the port number from the client's Host:
  header used to be tossed, and there is no clean mechanism to pass it
  (in the request_rec) to other consumers. As the unparsed_uri structure
  (which could avoid repeated parsing of URI, Host, Port etc) seems to be
  mostly unused currently, I used that to pass the port.
  
  Revision  Changes    Path
  1.421     +4 -1      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.420
  retrieving revision 1.421
  diff -u -r1.420 -r1.421
  --- CHANGES	2001/11/08 12:34:20	1.420
  +++ CHANGES	2001/11/08 14:29:36	1.421
  @@ -5,7 +5,10 @@
        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]
  +     work, even with https:// connections. As in Apache-1.3, the
  +     connection's actual port number is never used, only the ServerName
  +     setting or the client's Host: setting. Documentation updated
  +     to reflect the change. [Martin Kraemer]
   
     *) Add a '%{note-name}e' argument to mod-headers, which works in
        the same way as mod_log_confg.  [Ian Holsman]
  
  
  
  1.88      +19 -7     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- core.c	2001/11/08 12:34:21	1.87
  +++ core.c	2001/11/08 14:29:36	1.88
  @@ -752,17 +752,29 @@
       core_dir_config *d =
         (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);
       
  -    port = r->server->port ? r->server->port : ap_default_port(r);
  -
       if (d->use_canonical_name == USE_CANONICAL_NAME_OFF
   	|| d->use_canonical_name == USE_CANONICAL_NAME_DNS) {
  -        if (r->connection && r->connection->client_socket) {
  -            apr_sockaddr_t *localsa;
  +
  +        /* 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 ? r->parsed_uri.port :
  +               r->server->port ? r->server->port :
  +               ap_default_port(r);
  +    }
  +    else { /* d->use_canonical_name == USE_CANONICAL_NAME_ON */
   
  -            apr_socket_addr_get(&localsa, APR_LOCAL, r->connection->client_socket);
  -            apr_sockaddr_port_get(&port, localsa);
  -        }
  +        /* With UseCanonicalName on (and in all versions prior to 1.3)
  +	 * Apache will use the hostname and port specified in the
  +	 * ServerName directive to construct a canonical name for the
  +	 * server. (If no port was specified in the ServerName
  +         * directive, Apache implies port 80 for http:// and
  +	 * port 443 for https://)
  +	 */
  +        port = r->server->port ? r->server->port : ap_default_port(r);
       }
  +
       /* default */
       return port;
   }
  
  
  
  1.61      +9 -0      httpd-2.0/server/vhost.c
  
  Index: vhost.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/vhost.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- vhost.c	2001/11/07 19:59:51	1.60
  +++ vhost.c	2001/11/08 14:29:36	1.61
  @@ -754,6 +754,15 @@
            */
           host = apr_psprintf(r->pool, "%d", (int)port);
       }
  +    else if (port) {
  +        /* Don't throw the Host: header's port number away:
  +	   save it in parsed_uri -- ap_get_server_port() needs it! */
  +        /* @@@ XXX there should be a better way to pass the port.
  +	 *         Like r->hostname, there should be a r->portno
  +	 */
  +        r->parsed_uri.port = port;
  +	r->parsed_uri.port_str = apr_psprintf(r->pool, "%d", (int)port);
  +    }
   
       /* if the hostname is an IPv6 numeric address string, it was validated 
        * already; otherwise, further validation is needed 
  
  
  
  1.200     +18 -7     httpd-2.0/docs/manual/mod/core.html
  
  Index: core.html
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/core.html,v
  retrieving revision 1.199
  retrieving revision 1.200
  diff -u -r1.199 -r1.200
  --- core.html	2001/10/19 05:52:07	1.199
  +++ core.html	2001/11/08 14:29:37	1.200
  @@ -2232,12 +2232,21 @@
       section specifies what hostname must appear in the request's
       <code>Host:</code> header to match this virtual host.</p>
   
  -    <p>This directive now takes allows a port to be added to the
  +    <p>This directive now allows a port to be added to the
       server name.  This allows an admin to assign the canonical
       port at the same time that the canonical name is assigned.
  -    The Port directive, which used to perform this role, has also
  -    been removed, easing configuration for all users. 
  +    The Port directive in Apache-1.3, which used to perform this role, has also
  +    been removed, easing configuration for all users.</p>
   
  +    <p>If the port has been specified, then automatic redirections
  +    (e.g., by the <a href="mod_dir.html">mod_dir</a> module) will
  +    <em>always</em> use the given port, no matter what the actual
  +    request's port number was. If no port number was specified, however,
  +    the setting of <a href="#usecanonicalname">UseCanonicalName</a>
  +    decides whether the default port (80 for http://, 443 for https://),
  +    or the actual port the request came in on, will be used in redirections.
  +    </p>
  +
       <p><strong>See Also</strong>:<br />
        <a href="../dns-caveats.html">DNS Issues</a><br />
        <a href="../vhosts/">Apache virtual host
  @@ -2547,10 +2556,12 @@
       <p>In many situations Apache has to construct a
       <em>self-referential</em> URL. That is, a URL which refers back
       to the same server. With <code>UseCanonicalName on</code> (and
  -    in all versions prior to 1.3) Apache will use the <a
  -    href="#servername">ServerName</a> and <a 
  -    href="mpm_common.html#listen">Listen</a>
  -    directives to construct a canonical name for the server. This
  +    in all versions prior to 1.3) Apache will use the hostname and
  +    port specified in the <a href="#servername">ServerName</a>
  +    directive to construct a canonical name for the server.
  +    (If no port was specified in the <a href="#servername">ServerName</a>
  +    directive, Apache implies port 80 for http:// and port 443 for https://)
  +    This
       name is used in all self-referential URLs, and for the values
       of <code>SERVER_NAME</code> and <code>SERVER_PORT</code> in
       CGIs.</p>
  
  
  

Mime
View raw message