You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2006/12/07 21:01:09 UTC

svn commit: r483633 - in /httpd/httpd/trunk: CHANGES modules/http/http_filters.c

Author: rpluem
Date: Thu Dec  7 12:01:07 2006
New Revision: 483633

URL: http://svn.apache.org/viewvc?view=rev&rev=483633
Log:
* Do not replace a Date header set by a proxied backend server.

PR: 40232

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/http/http_filters.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?view=diff&rev=483633&r1=483632&r2=483633
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Dec  7 12:01:07 2006
@@ -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]

Modified: httpd/httpd/trunk/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?view=diff&rev=483633&r1=483632&r2=483633
==============================================================================
--- httpd/httpd/trunk/modules/http/http_filters.c (original)
+++ httpd/httpd/trunk/modules/http/http_filters.c Thu Dec  7 12:01:07 2006
@@ -741,16 +741,28 @@
     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 @@
         }
     }
     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());
     }