You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2006/04/19 12:02:06 UTC
svn commit: r395190 - in /httpd/httpd/branches/2.0.x: CHANGES STATUS
modules/proxy/proxy_http.c
Author: colm
Date: Wed Apr 19 03:02:04 2006
New Revision: 395190
URL: http://svn.apache.org/viewcvs?rev=395190&view=rev
Log:
Merge r102320 from trunk:
If the proxy was enabled, and UseCanonicalHostname was off, then the Via:
header would report not the proxy hosts's ServerName (or any of its
configured VHosts's names) as it should, but the *origin hosts*'s name. Now
it reports its ServerName.
Author: martin
Modified:
httpd/httpd/branches/2.0.x/CHANGES
httpd/httpd/branches/2.0.x/STATUS
httpd/httpd/branches/2.0.x/modules/proxy/proxy_http.c
Modified: httpd/httpd/branches/2.0.x/CHANGES
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/CHANGES?rev=395190&r1=395189&r2=395190&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.0.x/CHANGES [utf-8] Wed Apr 19 03:02:04 2006
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache 2.0.57
+ *) mod_proxy: Report the proxy server name correctly in the "Via:" header,
+ when UseCanonicalName is Off. PR 11971. [Martin Kraemer]
+
*) mod_isapi: Various trivial code-fixes to permit mod_isapi to load and
run on Unix. [William Wrowe]
Modified: httpd/httpd/branches/2.0.x/STATUS
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/STATUS?rev=395190&r1=395189&r2=395190&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/STATUS (original)
+++ httpd/httpd/branches/2.0.x/STATUS Wed Apr 19 03:02:04 2006
@@ -135,15 +135,6 @@
http://svn.apache.org/viewcvs?rev=395079&view=rev
+1: colm, wrowe, niq
- *) mod_proxy: Fix PR 11971 (HTTP proxy header "Via" with wrong hostname
- if ServerName not set or UseCanonicalName Off) by
- backporting r102320.
- Trunk version of patch:
- http://svn.apache.org/viewcvs?rev=102320&view=rev
- 2.0.x version of patch:
- http://issues.apache.org/bugzilla/attachment.cgi?id=18037
- +1: rpluem, jim, niq
-
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ please place SVN revisions from trunk here, so it is easy to
identify exactly what the proposed changes are! Add all new
Modified: httpd/httpd/branches/2.0.x/modules/proxy/proxy_http.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/branches/2.0.x/modules/proxy/proxy_http.c?rev=395190&r1=395189&r2=395190&view=diff
==============================================================================
--- httpd/httpd/branches/2.0.x/modules/proxy/proxy_http.c (original)
+++ httpd/httpd/branches/2.0.x/modules/proxy/proxy_http.c Wed Apr 19 03:02:04 2006
@@ -925,6 +925,14 @@
/* Block all outgoing Via: headers */
apr_table_unset(r->headers_in, "Via");
} else if (conf->viaopt != via_off) {
+ const char *server_name = ap_get_server_name(r);
+ /* If USE_CANONICAL_NAME_OFF was configured for the proxy virtual host,
+ * then the server name returned by ap_get_server_name() is the
+ * origin server name (which does make too much sense with Via: headers)
+ * so we use the proxy vhost's name instead.
+ */
+ if (server_name == r->hostname)
+ server_name = r->server->server_hostname;
/* Create a "Via:" request header entry and merge it */
/* Generate outgoing Via: header with/without server comment: */
apr_table_mergen(r->headers_in, "Via",
@@ -932,12 +940,12 @@
? apr_psprintf(p, "%d.%d %s%s (%s)",
HTTP_VERSION_MAJOR(r->proto_num),
HTTP_VERSION_MINOR(r->proto_num),
- ap_get_server_name(r), server_portstr,
+ server_name, server_portstr,
AP_SERVER_BASEVERSION)
: apr_psprintf(p, "%d.%d %s%s",
HTTP_VERSION_MAJOR(r->proto_num),
HTTP_VERSION_MINOR(r->proto_num),
- ap_get_server_name(r), server_portstr)
+ server_name, server_portstr)
);
}
@@ -1410,19 +1418,28 @@
/* handle Via header in response */
if (conf->viaopt != via_off && conf->viaopt != via_block) {
+ const char *server_name = ap_get_server_name(r);
+ /* If USE_CANONICAL_NAME_OFF was configured for the proxy virtual host,
+ * then the server name returned by ap_get_server_name() is the
+ * origin server name (which does make too much sense with Via: headers)
+ * so we use the proxy vhost's name instead.
+ */
+ if (server_name == r->hostname)
+ server_name = r->server->server_hostname;
+
/* create a "Via:" response header entry and merge it */
apr_table_mergen(r->headers_out, "Via",
(conf->viaopt == via_full)
? apr_psprintf(p, "%d.%d %s%s (%s)",
HTTP_VERSION_MAJOR(r->proto_num),
HTTP_VERSION_MINOR(r->proto_num),
- ap_get_server_name(r),
+ server_name,
server_portstr,
AP_SERVER_BASEVERSION)
: apr_psprintf(p, "%d.%d %s%s",
HTTP_VERSION_MAJOR(r->proto_num),
HTTP_VERSION_MINOR(r->proto_num),
- ap_get_server_name(r),
+ server_name,
server_portstr)
);
}