httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@hyperreal.org
Subject cvs commit: apache-1.3/src/main http_core.c
Date Sun, 08 Feb 1998 23:15:35 GMT
randy       98/02/08 15:15:35

  Modified:    src/main http_core.c
  Log:
  Fix a problem where r->server->port could be used without being
  properly initialized for the active protocol.
  Reviewed by: Dean Gaudet
  
  Revision  Changes    Path
  1.157     +13 -5     apache-1.3/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_core.c,v
  retrieving revision 1.156
  retrieving revision 1.157
  diff -u -r1.156 -r1.157
  --- http_core.c	1998/02/02 22:33:32	1.156
  +++ http_core.c	1998/02/08 23:15:34	1.157
  @@ -595,14 +595,17 @@
   
   API_EXPORT(unsigned) get_server_port(const request_rec *r)
   {
  +    unsigned port;
       core_dir_config *d =
         (core_dir_config *)get_module_config(r->per_dir_config, &core_module);
       
  +    port = r->server->port ? r->server->port : default_port(r);
  +
       if (d->use_canonical_name & 1) {
  -	return r->server->port;
  +	return port;
       }
       return r->hostname ? ntohs(r->connection->local_addr.sin_port)
  -			: r->server->port;
  +			: port;
   }
   
   API_EXPORT(char *) construct_url(pool *p, const char *uri, const request_rec *r)
  @@ -614,12 +617,17 @@
         (core_dir_config *)get_module_config(r->per_dir_config, &core_module);
   
       if (d->use_canonical_name & 1) {
  -	port = r->server->port;
  +	port = r->server->port ? r->server->port : default_port(r);
   	host = r->server->server_hostname;
       }
       else {
  -	port = r->hostname ? ntohs(r->connection->local_addr.sin_port)
  -			    : r->server->port;
  +        if (r->hostname)
  +            port = ntohs(r->connection->local_addr.sin_port);
  +        else if (r->server->port)
  +            port = r->server->port;
  +        else
  +            port = default_port(r);
  +
   	host = r->hostname ? r->hostname : r->server->server_hostname;
       }
       if (is_default_port(port, r)) {
  
  
  

Mime
View raw message