From: Ruediger Pluem Date: Thu, 7 Dec 2006 20:01:07 +0000 (+0000) Subject: * Do not replace a Date header set by a proxied backend server. X-Git-Tag: 2.3.0~1993 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3adcae3ebc8b943d0e73630ec305e78d2937a94c;p=thirdparty%2Fapache%2Fhttpd.git * Do not replace a Date header set by a proxied backend server. PR: 40232 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@483633 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index c8c87acd3fe..4b6b6e41710 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.3.0 [Remove entries to the current 2.0 and 2.2 section below, when backported] + *) core: Do not replace a Date header set by a proxied backend server. + PR 40232. [Ruediger Pluem] + *) mod_proxy: Ensure that at least scheme://hostname[:port] matches between worker and URL when searching for the best fitting worker for a given URL. PR 40910. [Ruediger Pluem] diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c index 57b780de743..75d84cc89a7 100644 --- a/modules/http/http_filters.c +++ b/modules/http/http_filters.c @@ -741,16 +741,28 @@ static void basic_http_header(request_rec *r, apr_bucket_brigade *bb, apr_brigade_writev(bb, NULL, NULL, vec, 4); #endif - date = apr_palloc(r->pool, APR_RFC822_DATE_LEN); - ap_recent_rfc822_date(date, r->request_time); - h.pool = r->pool; h.bb = bb; - form_header_field(&h, "Date", date); - /* keep the set-by-proxy server header, otherwise - * generate a new server header */ + /* + * keep the set-by-proxy server and date headers, otherwise + * generate a new server header / date header + */ if (r->proxyreq != PROXYREQ_NONE) { + const char *proxy_date; + + proxy_date = apr_table_get(r->headers_out, "Date"); + if (!proxy_date) { + /* + * proxy_date needs to be const. So use date for the creation of + * our own Date header and pass it over to proxy_date later to + * avoid a compiler warning. + */ + date = apr_palloc(r->pool, APR_RFC822_DATE_LEN); + ap_recent_rfc822_date(date, r->request_time); + proxy_date = date; + } + form_header_field(&h, "Date", proxy_date); server = apr_table_get(r->headers_out, "Server"); if (server) { form_header_field(&h, "Server", server); @@ -759,6 +771,9 @@ static void basic_http_header(request_rec *r, apr_bucket_brigade *bb, } } else { + date = apr_palloc(r->pool, APR_RFC822_DATE_LEN); + ap_recent_rfc822_date(date, r->request_time); + form_header_field(&h, "Date", date); form_header_field(&h, "Server", ap_get_server_banner()); }