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/modules/proxy proxy_ftp.c proxy_http.c proxy_util.c
Date Wed, 26 May 2004 12:00:59 GMT
trawick     2004/05/26 05:00:59

  Modified:    .        Tag: APACHE_2_0_BRANCH STATUS CHANGES
               modules/proxy Tag: APACHE_2_0_BRANCH proxy_ftp.c
                        proxy_http.c proxy_util.c
  Log:
  back-port this from 2.1-dev:
  
    Fix handling of IPv6 numeric strings in mod_proxy.
  
  Submitted by:	trawick
  Reviewed by:	minfrin, nd
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.751.2.884 +1 -7      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.883
  retrieving revision 1.751.2.884
  diff -u -r1.751.2.883 -r1.751.2.884
  --- STATUS	26 May 2004 11:50:42 -0000	1.751.2.883
  +++ STATUS	26 May 2004 12:00:57 -0000	1.751.2.884
  @@ -83,12 +83,6 @@
          PR 24922 [Pascal Terjan <pterjan@linuxfr.org>]
          +1: minfrin, nd
   
  -    *) Fix handling of IPv6 numeric strings in mod_proxy.
  -         modules/proxy/proxy_ftp.c r1.141, r1.142
  -         modules/proxy/proxy_http.c r1.186
  -         modules/proxy/proxy_util.c r1.107
  -       +1: trawick, minfrin, nd
  -
       *) RPM spec file changes: changed default dependancy to link to db4
          instead of db3. Fixed complaints about unpackaged files.
          build/rpm/httpd.spec.in: r1.5
  
  
  
  1.988.2.285 +2 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.284
  retrieving revision 1.988.2.285
  diff -u -r1.988.2.284 -r1.988.2.285
  --- CHANGES	26 May 2004 11:50:42 -0000	1.988.2.284
  +++ CHANGES	26 May 2004 12:00:57 -0000	1.988.2.285
  @@ -1,5 +1,7 @@
   Changes with Apache 2.0.50
   
  +  *) Fix handling of IPv6 numeric strings in mod_proxy.  [Jeff Trawick]
  +
     *) mod_isapi: send_response_header() failed to copy status string's 
        last character.  PR 20619.  [Jesse Pelton <jsp pkc.com>]
   
  
  
  
  No                   revision
  No                   revision
  1.130.2.7 +3 -0      httpd-2.0/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.130.2.6
  retrieving revision 1.130.2.7
  diff -u -r1.130.2.6 -r1.130.2.7
  --- proxy_ftp.c	9 Feb 2004 20:53:19 -0000	1.130.2.6
  +++ proxy_ftp.c	26 May 2004 12:00:58 -0000	1.130.2.7
  @@ -205,6 +205,9 @@
       else
           sport[0] = '\0';
   
  +    if (ap_strchr_c(host, ':')) { /* if literal IPv6 address */
  +        host = apr_pstrcat(p, "[", host, "]", NULL);
  +    }
       r->filename = apr_pstrcat(p, "proxy:ftp://", (user != NULL) ? user : "",
                                 (password != NULL) ? ":" : "",
                                 (password != NULL) ? password : "",
  
  
  
  1.164.2.11 +8 -1      httpd-2.0/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
  retrieving revision 1.164.2.10
  retrieving revision 1.164.2.11
  diff -u -r1.164.2.10 -r1.164.2.11
  --- proxy_http.c	7 May 2004 21:49:34 -0000	1.164.2.10
  +++ proxy_http.c	26 May 2004 12:00:58 -0000	1.164.2.11
  @@ -71,8 +71,12 @@
        */
       port = def_port;
       err = ap_proxy_canon_netloc(r->pool, &url, NULL, NULL, &host, &port);
  -    if (err)
  +    if (err) {
  +        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
  +                      "error parsing URL %s: %s",
  +                      url, err);
           return HTTP_BAD_REQUEST;
  +    }
   
       /* now parse path/search args, according to rfc1738 */
       /* N.B. if this isn't a true proxy request, then the URL _path_
  @@ -97,6 +101,9 @@
       else
           sport[0] = '\0';
   
  +    if (ap_strchr_c(host, ':')) { /* if literal IPv6 address */
  +        host = apr_pstrcat(r->pool, "[", host, "]", NULL);
  +    }
       r->filename = apr_pstrcat(r->pool, "proxy:", scheme, "://", host, sport, 
               "/", path, (search) ? "?" : "", (search) ? search : "", NULL);
       return OK;
  
  
  
  1.99.2.6  +14 -36    httpd-2.0/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v
  retrieving revision 1.99.2.5
  retrieving revision 1.99.2.6
  diff -u -r1.99.2.5 -r1.99.2.6
  --- proxy_util.c	9 Feb 2004 20:53:19 -0000	1.99.2.5
  +++ proxy_util.c	26 May 2004 12:00:58 -0000	1.99.2.6
  @@ -197,9 +197,10 @@
        ap_proxy_canon_netloc(apr_pool_t *p, char **const urlp, char **userp,
   			char **passwordp, char **hostp, apr_port_t *port)
   {
  -    int i;
  -    char *strp, *host, *url = *urlp;
  +    char *addr, *scope_id, *strp, *host, *url = *urlp;
       char *user = NULL, *password = NULL;
  +    apr_port_t tmp_port;
  +    apr_status_t rv;
   
       if (url[0] != '/' || url[1] != '/')
   	return "Malformed URL";
  @@ -238,44 +239,21 @@
   	*passwordp = password;
       }
   
  -    strp = strrchr(host, ':');
  -    if (strp != NULL) {
  -	*(strp++) = '\0';
  -
  -	for (i = 0; strp[i] != '\0'; i++)
  -	    if (!apr_isdigit(strp[i]))
  -		break;
  -
  -	/* if (i == 0) the no port was given; keep default */
  -	if (strp[i] != '\0') {
  -	    return "Bad port number in URL";
  -	} else if (i > 0) {
  -            int int_port = atoi(strp);
  -
  -	    if (int_port > 65535)
  -		return "Port number in URL > 65535";
  -
  -	    *port = (apr_port_t)int_port;
  -	}
  +    /* Parse the host string to separate host portion from optional port.
  +     * Perform range checking on port.
  +     */
  +    rv = apr_parse_addr_port(&addr, &scope_id, &tmp_port, host, p);
  +    if (rv != APR_SUCCESS || addr == NULL || scope_id != NULL) {
  +        return "Invalid host/port";
       }
  -    ap_str_tolower(host);		/* DNS names are case-insensitive */
  -    if (*host == '\0')
  -	return "Missing host in URL";
  -/* check hostname syntax */
  -    for (i = 0; host[i] != '\0'; i++)
  -	if (!apr_isdigit(host[i]) && host[i] != '.')
  -	    break;
  -    /* must be an IP address */
  -    if (host[i] == '\0' && (apr_inet_addr(host) == -1))
  -    {
  -	return "Bad IP address in URL";
  +    if (tmp_port != 0) { /* only update caller's port if port was specified */
  +        *port = tmp_port;
       }
   
  -/*    if (strchr(host,'.') == NULL && domain != NULL)
  -   host = pstrcat(p, host, domain, NULL);
  - */
  +    ap_str_tolower(addr); /* DNS names are case-insensitive */
  +
       *urlp = url;
  -    *hostp = host;
  +    *hostp = addr;
   
       return NULL;
   }
  
  
  

Mime
View raw message