httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject cvs commit: apache-1.3/src/main http_core.c
Date Mon, 17 Nov 2003 17:14:53 GMT
jim         2003/11/17 09:14:53

  Modified:    src      CHANGES
               src/main http_core.c
  Log:
  Make UseCanonicalName off correctly grab port info from
  the client. Make UseCanonicalName socket port aware.
  
  Revision  Changes    Path
  1.1912    +3 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1911
  retrieving revision 1.1912
  diff -u -r1.1911 -r1.1912
  --- CHANGES	12 Nov 2003 19:55:15 -0000	1.1911
  +++ CHANGES	17 Nov 2003 17:14:52 -0000	1.1912
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.30
   
  +  *) UseCanonicalName off was ignoring the client provided
  +     port information. [Jim Jagielski]
  +
   Changes with Apache 1.3.29
   
     *) SECURITY: CAN-2003-0542 (cve.mitre.org)
  
  
  
  1.327     +16 -5     apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.326
  retrieving revision 1.327
  diff -u -r1.326 -r1.327
  --- http_core.c	19 Oct 2003 13:20:57 -0000	1.326
  +++ http_core.c	17 Nov 2003 17:14:53 -0000	1.327
  @@ -826,16 +826,27 @@
   API_EXPORT(unsigned) ap_get_server_port(const request_rec *r)
   {
       unsigned port;
  +    unsigned cport = ntohs(r->connection->local_addr.sin_port);
       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) {
  -        return r->hostname ? ntohs(r->connection->local_addr.sin_port)
  -			   : port;
  +        || 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 : 
  +          cport ? cport :
  +            r->server->port ? r->server->port :
  +              ap_default_port(r);
  +    } else { /* d->use_canonical_name == USE_CANONICAL_NAME_ON */
  +        port = r->server->port ? r->server->port : 
  +          cport ? cport :
  +            ap_default_port(r);
       }
  +
       /* default */
       return port;
   }
  
  
  

Mime
View raw message