httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Tue, 22 Apr 2003 14:51:44 GMT
trawick     2003/04/22 07:51:43

  Modified:    .        CHANGES
               server   core.c
  Log:
  Fix ap_construct_url() so that it surrounds IPv6 literal address
  strings with [].  This fixes certain types of redirection.
  
  PR:             19207
  
  Revision  Changes    Path
  1.1151    +4 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1150
  retrieving revision 1.1151
  diff -u -r1.1150 -r1.1151
  --- CHANGES	18 Apr 2003 19:39:54 -0000	1.1150
  +++ CHANGES	22 Apr 2003 14:51:40 -0000	1.1151
  @@ -2,6 +2,10 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Fix ap_construct_url() so that it surrounds IPv6 literal address
  +     strings with [].  This fixes certain types of redirection.
  +     PR 19207.  [Jeff Trawick]
  +
     *) mod_log_config: Add the ability to log the id of the thread 
        processing the request via new %P formats.  [Jeff Trawick]
   
  
  
  
  1.232     +18 -1     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.231
  retrieving revision 1.232
  diff -u -r1.231 -r1.232
  --- core.c	3 Feb 2003 17:53:18 -0000	1.231
  +++ core.c	22 Apr 2003 14:51:42 -0000	1.232
  @@ -885,6 +885,23 @@
       return r->server->server_hostname;
   }
   
  +/*
  + * Get the current server name from the request for the purposes
  + * of using in a URL.  If the server name is an IPv6 literal
  + * address, it will be returned in URL format (e.g., "[fe80::1]").
  + */
  +static const char *get_server_name_for_url(request_rec *r)
  +{
  +    const char *plain_server_name = ap_get_server_name(r);
  +
  +#ifdef APR_HAVE_IPV6
  +    if (ap_strchr_c(plain_server_name, ':')) { /* IPv6 literal? */
  +        return apr_psprintf(r->pool, "[%s]", plain_server_name);
  +    }
  +#endif
  +    return plain_server_name;
  +}
  +
   AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r)
   {
       apr_port_t port;
  @@ -925,7 +942,7 @@
                                       request_rec *r)
   {
       unsigned port = ap_get_server_port(r);
  -    const char *host = ap_get_server_name(r);
  +    const char *host = get_server_name_for_url(r);
   
       if (ap_is_default_port(port, r)) {
           return apr_pstrcat(p, ap_http_method(r), "://", host, uri, NULL);
  
  
  

Mime
View raw message