Copilot commented on code in PR #13486:
URL: https://github.com/apache/trafficserver/pull/13486#discussion_r3714106864
##########
tests/gold_tests/pluginTest/header_rewrite/post_remap.conf:
##########
@@ -17,11 +17,16 @@
# Global header_rewrite ruleset that fires after remapping, on the remapped
# request, before the cache lookup. The value is the remapped host, so an
-# earlier hook would record the pristine host instead.
+# earlier hook would record the pristine host instead. Setting a state flag
+# also verifies that operators which inherit the default hook list are valid
+# at POST_REMAP_HOOK.
cond %{POST_REMAP_HOOK}
+ set-state-flag 0 true
set-header X-Post-Remap-Host "%{URL:HOST}"
# Echo the post-remap header into the client response so the rule above can be
-# observed on a cache hit, where no request is forwarded to the origin.
+# observed on a cache hit, where no request is forwarded to the origin. The
+# state condition proves that the state operator also ran at POST_REMAP_HOOK.
cond %{SEND_RESPONSE_HDR_HOOK}
+cond %{STATE-FLAG:0} =TRUE
set-header X-Post-Remap-Echo "%{CLIENT-HEADER:X-Post-Remap-Host}"
Review Comment:
The second `cond` appears intended to be combined with
`SEND_RESPONSE_HDR_HOOK`, but it is not nested/indented under it. In
header_rewrite configs, indentation controls condition grouping; as written,
`cond %{STATE-FLAG:0} =TRUE` starts a new top-level condition chain and the
`set-header` may no longer be reliably scoped to `SEND_RESPONSE_HDR_HOOK`.
Indent the state-flag condition (and its action) under `cond
%{SEND_RESPONSE_HDR_HOOK}` so the echo header is only set when both conditions
are true.
--
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]