From bfc79f2e09d1d1625d68433d855b21fb37ff42cf Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Mon, 25 Mar 2002 22:45:05 +0000 Subject: [PATCH] Tighten up the overridden-Server-header bugfix in the proxy, by only overriding if the request is a proxy request. It has been pointed out that the previous fix allows CGIs and modules to override the Server header, which is change to previous behavior. PR: Obtained from: Submitted by: Graham Leggett, Joshua Slive Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@94165 13f79535-47bb-0310-9956-ffa450edef68 --- src/CHANGES | 6 ++++++ src/main/http_protocol.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/CHANGES b/src/CHANGES index 5a6cbe3914d..1b9b9a80462 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,11 @@ Changes with Apache 1.3.25 + *) Tighten up the overridden-Server-header bugfix in the proxy, by + only overriding if the request is a proxy request. It has been + pointed out that the previous fix allows CGIs and modules to + override the Server header, which is change to previous behavior. + [Graham Leggett, Joshua Slive] + *) Another fix for the multiple-cookie header bug in proxy. With some luck this bug is actually now dead. [Graham Leggett] diff --git a/src/main/http_protocol.c b/src/main/http_protocol.c index 7da84f785b3..0373a490c1f 100644 --- a/src/main/http_protocol.c +++ b/src/main/http_protocol.c @@ -1513,7 +1513,6 @@ API_EXPORT_NONSTD(int) ap_send_header_field(request_rec *r, API_EXPORT(void) ap_basic_http_header(request_rec *r) { char *protocol; - const char *server; if (r->assbackwards) return; @@ -1542,10 +1541,13 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r) /* output the date header */ ap_send_header_field(r, "Date", ap_gm_timestr_822(r->pool, r->request_time)); - /* keep a previously set server header (possible from proxy), otherwise + /* keep the set-by-proxy server header, otherwise * generate a new server header */ - if (server = ap_table_get(r->headers_out, "Server")) { - ap_send_header_field(r, "Server", server); + if (r->proxyreq) { + const char *server = ap_table_get(r->headers_out, "Server"); + if (server) { + ap_send_header_field(r, "Server", server); + } } else { ap_send_header_field(r, "Server", ap_get_server_version()); -- 2.47.2