Tests: gzip Accept-Encoding HTAB whitespace - #97
Open
louzt wants to merge 1 commit into
Open
Conversation
louzt
force-pushed
the
test/gzip-accept-encoding-htab
branch
from
August 8, 2026 01:05
1e40ecd to
beaaabf
Compare
Adds gzip_accept_encoding_htab.t, a focused regression test for HTAB handling in the Accept-Encoding request header. Per RFC 9110 §5.6.2 / §5.6.3, the surrounding field grammar defines optional whitespace as SP / HTAB, and Vadim's nginx#1577 already taught the multi-header parser to accept HTAB. The gzip_accept_encoding helper in ngx_http_core_module.c carries its own boundary check, so it must be updated to match. The TODO block carries four forward-looking cases that currently fail on master (HTAB before comma, between tokens, before q-value, after q-value); they document the gap and will pass once the companion C change lands. The baseline cases (SP, no whitespace, HTAB after comma) already pass and are held as regression sentinels.
louzt
force-pushed
the
test/gzip-accept-encoding-htab
branch
from
August 8, 2026 01:12
beaaabf to
735b981
Compare
louzt
marked this pull request as ready for review
August 8, 2026 01:13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
gzip_accept_encoding_htab.t, a focused regression test for HTABhandling in the Accept-Encoding request header. Per RFC 9110 §5.6.2 /
§5.6.3, the surrounding field grammar defines optional whitespace as
SP / HTAB, and Vadim's nginx#1577 already taught the multi-header parser
to accept HTAB. The gzip_accept_encoding helper in
ngx_http_core_module.ccarries its own boundary check, so it must beupdated to match.
The gap is the single-character path that runs after the
gziptokenhas been matched: the switches in
ngx_http_gzip_accept_encoding()only carry
case ' 'and exit on the bare comma that ends the list,so HTAB falls into the
defaultbranch and the encoding is rejected.The test covers four baseline cases that document the current
behaviour (SP, no whitespace, HTAB after comma, malformed input
without comma) and three TODO cases that document the gap and will
succeed once the companion nginx#1627 lands.
The malformed-input case (
gzip\tdeflate, no comma) is held as abaseline regression: RFC 9110 §5.6.2 requires comma separators
between elements, and whitespace alone is not enough.
Testing
Verified against a patched and an unpatched binary:
expected, 4 baseline cases pass, suite reports PASS.
succeed.
gzip.tregression suite: 10/10 pass on the patched binary.Companion C PR
nginx#1627: HTTP: HTAB support in Accept-Encoding list parsing
(5-line surgical patch to
ngx_http_core_module.c).References
Vadim explicitly carved
ngx_http_gzip_accept_encoding()outbecause the helper carries its own boundary check.
#rule).