HRW: Bug where after an elif an else may be required#12536
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Fix logic around incomplete rules in header_rewrite when encountering ELIF/ELSE blocks and correct a small argument handling bug in run-plugin initialization.
- Centralize rule-completion validation with a new helper to enforce constraints on ELIF/ELSE/OPER clauses without operators
- Adjust run-plugin argv population to iterate over token count rather than argc
- Minor parser/comment cleanups and a new ConditionGroup::has_conditions() helper
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plugins/header_rewrite/parser.cc | Comment cleanup and small whitespace tweak; no functional change. |
| plugins/header_rewrite/operators.cc | Fix loop bound to use tokens.size() for argv population in run-plugin. |
| plugins/header_rewrite/header_rewrite.cc | Introduce validate_rule_completion and use it during parsing; adjust when rules are validated/transferred. |
| plugins/header_rewrite/conditions.h | Add has_conditions() to expose whether a group has any conditions. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This also fixes a small bug in run-plugin
bneradt
approved these changes
Oct 6, 2025
zwoop
added a commit
to zwoop/trafficserver
that referenced
this pull request
Oct 10, 2025
zwoop
added a commit
that referenced
this pull request
Oct 13, 2025
Contributor
|
Put this back in the 10.1.x project. Great shame to the author for mixing unrelated bug fixes in one PR. :P |
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.
This also fixes a small bug in run-plugin.
I think this may be a candidate for v10.1.x, but not 100% sure if all these things are in 10.1.x ?
[Issue discovered by Fina.]