On Wed, 9 Sep 2020 at 17:43, <[email protected]> wrote: > Author: gbechis > Date: Wed Sep 9 14:43:07 2020 > New Revision: 1881590 > > URL: http://svn.apache.org/viewvc?rev=1881590&view=rev > Log: > handle headers when replying a 304 following rfc7234 > as discussed in bz 61820 > > Modified: > httpd/httpd/trunk/modules/http/http_filters.c > > Modified: httpd/httpd/trunk/modules/http/http_filters.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/http/http_filters.c?rev=1881590&r1=1881589&r2=1881590&view=diff > > ============================================================================== > --- httpd/httpd/trunk/modules/http/http_filters.c (original) > +++ httpd/httpd/trunk/modules/http/http_filters.c Wed Sep 9 14:43:07 2020 > @@ -1427,25 +1427,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"); > Maybe I am missing some context, but header names use dash, not underscore. I.e Content-Encoding, not Content_Encoding.
-- Ivan Zhakov
