Skip to content

mod_deflate: Keep the response Content-Encoding with the input filter - #1052

Open
arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/bz66149-deflate-input-content-encoding
Open

arturobernalg wants to merge 1 commit into
apache:trunkfrom
arturobernalg:fix/bz66149-deflate-input-content-encoding

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

https://bz.apache.org/bugzilla/show_bug.cgi?id=66149

With SetInputFilter DEFLATE, a response loses the Content-Encoding set for it, e.g. by AddEncoding x-gzip .gz.

check_gzip() syncs r->content_encoding with the Content-Encoding of the headers it is given. That is meant for the output filters, which pass the response headers. The input filter passes r->headers_in, so the response's encoding was replaced by the request's, usually none. It runs on any GET, since the default handler discards the request body through the input filters.

The sync is now done only for the response headers. A gzipped request body is still inflated as before.

Test: test_filters_009_03 in test/modules/filters/test_009_mod_deflate.py, with and without a gzipped request body. It fails on trunk and passes with the fix; the filters suite passes (104).


  • This PR does not report or address a security vulnerability
    (see SECURITY.md and
    https://www.apache.org/security/#reporting-a-vulnerability).
  • Code follows the httpd style guide.
  • New log messages (level debug or higher) use an empty APLOGNO() tag;
    numbers are assigned by a committer at merge time (see docs/log-message-tags/README).
  • If the change is user-visible, a changes-entries/*.txt file is included,
    following the template in README.CHANGES (not needed otherwise).
  • Test cases based on pyhttpd are included where appropriate, in the
    test/modules/xxx directory matching the modules/xxx module source,
    or test/modules/core for core server changes. On Unix, verify these
    pass locally with e.g. make check-pytest PYTEST_DIRS=test/modules/xxx.

check_gzip() syncs r->content_encoding with the Content-Encoding of the
headers it was given. That is meant for the response headers of the
output filters, but the input filter passes r->headers_in, so the
response's Content-Encoding (e.g. from AddEncoding) was replaced by the
request's, which is usually none.

Only sync it for the response headers.

PR 66149.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant