Skip to content

Test coverage for SubstituteMaxLineLength on the unmatched tail (#755) - #762

Closed
notroj wants to merge 2 commits into
apache:trunkfrom
notroj:pr755-testing
Closed

notroj wants to merge 2 commits into
apache:trunkfrom
notroj:pr755-testing

Conversation

@notroj

@notroj notroj commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Adds test/modules/filters/test_001_substitute_maxlen.py covering SubstituteMaxLineLength enforcement, together with the commit from #755 so the new cases have something to run against. This starts a test/modules/filters pyhttpd package, since mod_substitute lives in modules/filters/.

Sixteen cases: the four Substitute flag combinations (regex or literal n, flattened or quick q) 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 under SubstituteMaxLineLength 10 whenever 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

notroj and others added 2 commits September 16, 2026 22:19
  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)
@notroj
notroj deleted the pr755-testing branch September 17, 2026 06:52
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.

2 participants