]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Backport to 2.4:
authorGraham Leggett <minfrin@apache.org>
Sat, 16 Jan 2021 13:27:39 +0000 (13:27 +0000)
committerGraham Leggett <minfrin@apache.org>
Sat, 16 Jan 2021 13:27:39 +0000 (13:27 +0000)
  *) core: Correctly strip unwanted headers on 304 response
     Trunk version of patch:
        http://svn.apache.org/r1881590
        http://svn.apache.org/r1881624
     +1: ylavic, covener, minfrin

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1885569 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/http/http_filters.c

diff --git a/CHANGES b/CHANGES
index 4d6bf6969da34a2a9f8cc3da9fee02667af9104e..c11d634a14f74d423da4e80b64fd85a65ad9827f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.47
 
+  *) core: Remove headers on 304 Not Modified as specified by RFC7234, as
+     opposed to passing an explicit subset of headers. PR 61820.
+     [Giovanni Bechis]
+
   *) mpm_event: don't reset connections after lingering close, restoring prior
      to 2.4.28 behaviour.  [Yann Ylavic]
 
diff --git a/STATUS b/STATUS
index e20d3ed7d0e0b63d01093c8e4a23c6da0f8a95cf..bc52f1723ddb8545e7ce84f783fd4fffa691f726 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -138,12 +138,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) core: Correctly strip unwanted headers on 304 response
-     Trunk version of patch:
-        http://svn.apache.org/r1881590
-        http://svn.apache.org/r1881624
-     +1: ylavic, covener, minfrin
-
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index 3bb85c71c031f3b9d969127ed1c05a27d2e70c02..251b0ff73d9985a000ef4fc869ce993e17a39d70 100644 (file)
@@ -1497,25 +1497,21 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
     h.bb = b2;
 
     if (r->status == HTTP_NOT_MODIFIED) {
-        apr_table_do((int (*)(void *, const char *, const char *)) form_header_field,
-                     (void *) &h, r->headers_out,
-                     "Connection",
-                     "Keep-Alive",
-                     "ETag",
-                     "Content-Location",
-                     "Expires",
-                     "Cache-Control",
-                     "Vary",
-                     "Warning",
-                     "WWW-Authenticate",
-                     "Proxy-Authenticate",
-                     "Set-Cookie",
-                     "Set-Cookie2",
-                     NULL);
-    }
-    else {
-        send_all_header_fields(&h, r);
-    }
+      /*
+       * List of headers that must not be updated on a 304 (or 206 partial content)
+       * https://tools.ietf.org/id/draft-ietf-httpbis-cache-08.txt
+       */
+      apr_table_unset(r->headers_out, "Content-Encoding");
+      apr_table_unset(r->headers_out, "Content-Length");
+      apr_table_unset(r->headers_out, "Content-MD5");
+      apr_table_unset(r->headers_out, "Content-Range");
+      apr_table_unset(r->headers_out, "ETag");
+      apr_table_unset(r->headers_out, "TE");
+      apr_table_unset(r->headers_out, "Trailer");
+      apr_table_unset(r->headers_out, "Transfer-Encoding");
+      apr_table_unset(r->headers_out, "Upgrade");
+    }
+    send_all_header_fields(&h, r);
 
     terminate_header(b2);