diff options
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | modules/http/http_protocol.c | 21 |
2 files changed, 19 insertions, 7 deletions
@@ -1,5 +1,10 @@ Changes with Apache 2.0.46 + *) If a Date response header was already set in the headers array, + this value was ignored in favour of the current time. This meant + that Date headers on proxied requests where rewritten when they + should not have been. PR: 14376 [Graham Leggett] + *) Add code to buildconf that produces an httpd.spec file from httpd.spec.in, using build/get-version.sh from APR. [Graham Leggett] diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 14faecc8f2..49cc531d4b 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1240,7 +1240,7 @@ static void basic_http_header_check(request_rec *r, static void basic_http_header(request_rec *r, apr_bucket_brigade *bb, const char *protocol) { - char *date; + const char *date; const char *server; header_struct h; struct iovec vec[4]; @@ -1272,12 +1272,19 @@ 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); + /* keep a previously set date header (possibly from proxy), otherwise + * generate a new date header */ + if ((date = apr_table_get(r->headers_out, "Date")) != NULL) { + form_header_field(&h, "Date", date); + } + else { + char *now = apr_palloc(r->pool, APR_RFC822_DATE_LEN); + ap_recent_rfc822_date(now, r->request_time); - h.pool = r->pool; - h.bb = bb; - form_header_field(&h, "Date", date); + h.pool = r->pool; + h.bb = bb; + form_header_field(&h, "Date", now); + } /* keep a previously set server header (possibly from proxy), otherwise * generate a new server header */ @@ -1289,7 +1296,7 @@ static void basic_http_header(request_rec *r, apr_bucket_brigade *bb, } /* unset so we don't send them again */ - apr_table_unset(r->headers_out, "Date"); /* Avoid bogosity */ + apr_table_unset(r->headers_out, "Date"); apr_table_unset(r->headers_out, "Server"); } |