Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 39378 invoked by uid 500); 13 May 2003 16:01:06 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 39367 invoked by uid 500); 13 May 2003 16:01:06 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 13 May 2003 16:01:05 -0000 Message-ID: <20030513160105.11104.qmail@icarus.apache.org> From: trawick@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/server core.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N trawick 2003/05/13 09:01:05 Modified: . Tag: APACHE_2_0_BRANCH CHANGES STATUS server Tag: APACHE_2_0_BRANCH core.c Log: merge this fix from 2.1-dev: Fix ap_construct_url() so that it surrounds IPv6 literal address strings with []. This fixes certain types of redirection. PR: 19207 Reviewed by: Bill Stoddard, Thom May Revision Changes Path No revision No revision 1.988.2.89 +4 -0 httpd-2.0/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/httpd-2.0/CHANGES,v retrieving revision 1.988.2.88 retrieving revision 1.988.2.89 diff -u -r1.988.2.88 -r1.988.2.89 --- CHANGES 13 May 2003 15:39:07 -0000 1.988.2.88 +++ CHANGES 13 May 2003 16:01:03 -0000 1.988.2.89 @@ -1,5 +1,9 @@ Changes with Apache 2.0.46 + *) Fix ap_construct_url() so that it surrounds IPv6 literal address + strings with []. This fixes certain types of redirection. + PR 19207. [Jeff Trawick] + *) forward port of buffer overflow fixes for htdigest. [Thom May] *) Added AllowEncodedSlashes directive to permit control of whether 1.751.2.253 +1 -13 httpd-2.0/STATUS Index: STATUS =================================================================== RCS file: /home/cvs/httpd-2.0/STATUS,v retrieving revision 1.751.2.252 retrieving revision 1.751.2.253 diff -u -r1.751.2.252 -r1.751.2.253 --- STATUS 13 May 2003 15:51:04 -0000 1.751.2.252 +++ STATUS 13 May 2003 16:01:03 -0000 1.751.2.253 @@ -217,18 +217,6 @@ modules/mappers/config9.m4 r1.16 +1: trawick, nd, stoddard - * Fix ap_construct_url() so that it surrounds IPv6 literal address - strings with []. This fixes certain types of redirection. - PR 19207. - server/core.c r1.232 - +1: nd - Oops! While r1.232 isn't actually broken functionally, it will - do an unnecessary string search with non-IPv6 builds because of a - bogus check for IPv6 capability. - server/core.c r1.232+r1.235 - +1: trawick, stoddard, thommay - - * Hook mod_rewrite's type checker before mod_mime's one. That way the RewriteRule [T=...] Flag should work as expected now. PR 19626. modules/mappers/mod_rewrite.c r1.150 No revision No revision 1.225.2.6 +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.225.2.5 retrieving revision 1.225.2.6 diff -u -r1.225.2.5 -r1.225.2.6 --- core.c 8 May 2003 20:49:32 -0000 1.225.2.5 +++ core.c 13 May 2003 16:01:04 -0000 1.225.2.6 @@ -893,6 +893,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); + +#if 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; @@ -933,7 +950,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);