From: Graham Leggett Date: Thu, 21 Mar 2002 14:37:42 +0000 (+0000) Subject: Change ap_construct_url() so that the r->hostname is used in X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bb816593216b6c069652938ba737bb5bdfb869d;p=thirdparty%2Fapache%2Fhttpd.git Change ap_construct_url() so that the r->hostname is used in the URL instead of the value of the ServerName directive. This stops Apache redirecting to a different website name to the one the user typed in, which can break cookies and javascript handling on the client. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@94084 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/CHANGES b/src/CHANGES index 07065beb8b6..0b3e233d2d4 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,11 @@ Changes with Apache 1.3.24 + *) Change ap_construct_url() so that the r->hostname is used in + the URL instead of the value of the ServerName directive. This + stops Apache redirecting to a different website name to the + one the user typed in, which can break cookies and javascript + handling on the client. [Graham Leggett] + *) Fixed the previous multiple-cookie fix in the proxy. Cookies are broken in that they contain dates which in turn contain commas - so merging and then unmerging them breaks Set-Cookie diff --git a/src/main/http_core.c b/src/main/http_core.c index d37b04bd83b..bb7407c30dd 100644 --- a/src/main/http_core.c +++ b/src/main/http_core.c @@ -831,7 +831,7 @@ API_EXPORT(char *) ap_construct_url(pool *p, const char *uri, request_rec *r) { unsigned port = ap_get_server_port(r); - const char *host = ap_get_server_name(r); + const char *host = r->hostname; if (ap_is_default_port(port, r)) { return ap_pstrcat(p, ap_http_method(r), "://", host, uri, NULL);