Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 7384 invoked from network); 13 Jan 2004 16:11:57 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 13 Jan 2004 16:11:57 -0000 Received: (qmail 95792 invoked by uid 500); 13 Jan 2004 16:11:51 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 95757 invoked by uid 500); 13 Jan 2004 16:11:51 -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 95744 invoked by uid 500); 13 Jan 2004 16:11:50 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Received: (qmail 95741 invoked from network); 13 Jan 2004 16:11:50 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 13 Jan 2004 16:11:50 -0000 Received: (qmail 7367 invoked by uid 1086); 13 Jan 2004 16:11:55 -0000 Date: 13 Jan 2004 16:11:55 -0000 Message-ID: <20040113161155.7366.qmail@minotaur.apache.org> From: martin@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/proxy proxy_http.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N martin 2004/01/13 08:11:55 Modified: modules/proxy proxy_http.c Log: 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. Revision Changes Path 1.180 +20 -4 httpd-2.0/modules/proxy/proxy_http.c Index: proxy_http.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v retrieving revision 1.179 retrieving revision 1.180 diff -u -u -r1.179 -r1.180 --- proxy_http.c 12 Jan 2004 14:08:08 -0000 1.179 +++ proxy_http.c 13 Jan 2004 16:11:55 -0000 1.180 @@ -509,6 +509,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", @@ -516,12 +524,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) ); } @@ -902,19 +910,27 @@ /* 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) ); }