You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by mi...@apache.org on 2021/01/16 13:27:39 UTC

svn commit: r1885569 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS modules/http/http_filters.c

Author: minfrin
Date: Sat Jan 16 13:27:39 2021
New Revision: 1885569

URL: http://svn.apache.org/viewvc?rev=1885569&view=rev
Log:
Backport to 2.4:

  *) 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


Modified:
    httpd/httpd/branches/2.4.x/   (props changed)
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/modules/http/http_filters.c

Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
  Merged /httpd/httpd/trunk:r1881590,1881624

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1885569&r1=1885568&r2=1885569&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Sat Jan 16 13:27:39 2021
@@ -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]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1885569&r1=1885568&r2=1885569&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Sat Jan 16 13:27:39 2021
@@ -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:

Modified: httpd/httpd/branches/2.4.x/modules/http/http_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/http/http_filters.c?rev=1885569&r1=1885568&r2=1885569&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/http/http_filters.c (original)
+++ httpd/httpd/branches/2.4.x/modules/http/http_filters.c Sat Jan 16 13:27:39 2021
@@ -1497,25 +1497,21 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_
     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);