Commit b317e700 authored by Colm MacCarthaigh's avatar Colm MacCarthaigh
Browse files

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


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@395190 13f79535-47bb-0310-9956-ffa450edef68
parent ebe42a06
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
                                                         -*- 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]
+0 −9
Original line number Diff line number Diff line
@@ -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
+21 −4
Original line number Diff line number Diff line
@@ -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)
                );
            }