]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r102320 from trunk:
authorColm MacCarthaigh <colm@apache.org>
Wed, 19 Apr 2006 10:02:04 +0000 (10:02 +0000)
committerColm MacCarthaigh <colm@apache.org>
Wed, 19 Apr 2006 10:02:04 +0000 (10:02 +0000)
  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

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@395190 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/proxy/proxy_http.c

diff --git a/CHANGES b/CHANGES
index db5be5d572b8c006f2eb8eefb9927390435906e3..0fee9f17fef34ca6bad417c6cb9a4d7c0d526a00 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -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]
 
diff --git a/STATUS b/STATUS
index 481ef78f154db08cc8720d1f1fe9d49c02eecc9f..d7e28e888382da684ace501b4ff1ca21d8f990ad 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -135,15 +135,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
           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
index d4906fcaa6f728a03625c7914b1f8a282d9f3ab6..4cfe486d4a3ba14cbce621498c664850ac1aa1ac 100644 (file)
@@ -925,6 +925,14 @@ apr_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r,
         /* 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_status_t ap_proxy_http_request(apr_pool_t *p, request_rec *r,
                          ? 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 @@ apr_status_t ap_proxy_http_process_response(apr_pool_t * p, request_rec *r,
 
             /* 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)
                 );
             }