Conversation
test/modules/filters/conftest.py, test/modules/filters/env.py, test/modules/filters/test_001_substitute_maxlen.py: New test suite. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> GitHub: PR apache#755
Account for the unmatched tail after a successful substitution before emitting the result. This keeps SubstituteMaxLineLength effective for flattened literal substitutions and for both regular-expression paths. (cherry picked from commit 0aef5a3)
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
test/modules/filters/test_001_substitute_maxlen.pycoveringSubstituteMaxLineLengthenforcement, together with the commit from #755 so the new cases have something to run against. This starts atest/modules/filterspyhttpd package, sincemod_substitutelives inmodules/filters/.Sixteen cases: the four
Substituteflag combinations (regex or literaln, flattened or quickq) against three over-limit documents that differ in where the match sits, plus four exact-limit documents that must still be served at exactly the configured length. Without #755 four of them fail — the two regex paths return an 11-byte body underSubstituteMaxLineLength 10whenever the last match leaves a non-empty tail. With it, all sixteen pass.One note on the description of #755: it lists literal flatten (
nf) among the broken modes, but that did not reproduce on trunk here. Both literal modes rejected every over-length case tried — match at the start, in the middle, and at the end, plus a 9-byte line with two matches growing to 11 — so only the two regex paths appear to leak. Putting the match at the very end, leaving no unmatched tail, is correctly rejected in every mode, which is what points at the tail as the uncounted part. The fix itself looks right; if there is a literal-flatten case that does leak, the suite should grow one.🤖 Generated with Claude Code