zwoop commented on code in PR #13587:
URL: https://github.com/apache/trafficserver/pull/13587#discussion_r4234176031
##########
tools/hrw4u/src/hrw_symbols.py:
##########
@@ -413,7 +414,21 @@ def negate_expression(self, term: str) -> str:
return f"!({t})"
def percent_to_ident_or_func(self, percent: str, section: SectionType |
None) -> tuple[str, bool]:
- """Convert percent block to identifier or function call."""
+ """Convert a %{} block to an identifier or function call; trailing
[MODS] become a "with" clause."""
+ stripped, mods = split_percent_mods(percent)
+ expr, is_func = self._percent_to_ident_or_func(stripped, section)
+
+ if not mods:
+ return expr, is_func
+
+ # A block with no DSL equivalent comes back as %{...}, where the
modifiers belong
+ # inside the braces rather than in a "with" clause.
+ if expr == stripped:
+ return apply_percent_mods(expr, mods), is_func
+
+ return f"{expr} with {','.join(mods)}", is_func
+
Review Comment:
Only NORM applies to a value expansion. header_rewrite tolerates the other
modifiers there, but they do nothing, and hrw4u never generates them. If a
hand-written config has one, u4wrh carrying it into the `with` clause and hrw4u
rejecting it with "Not a value modifier, expected one of NORM" is the right
outcome: it points at the mistake, where filtering would silently drop it and
keeping it raw would pass a no-op through. Leaving it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]