bryancall commented on PR #12879:
URL: https://github.com/apache/trafficserver/pull/12879#issuecomment-3893085619

   ### New commit: Skip origin connection when set-body is used at remap hook
   
   Added a third commit that builds on the previous two:
   
   **Core change:** When `set-body` (via `TSHttpTxnErrorBodySet()`) is used at 
a pre-origin hook like `REMAP_PSEUDO_HOOK`, ATS now skips the origin connection 
entirely and serves a synthetic response. Previously it would still open a TCP 
connection to the origin, exchange headers, then throw away the body. The 
change is a single `internal_msg_buffer` check at the top of 
`how_to_open_connection()` in `HttpTransact.cc` -- if the buffer is set, build 
a synthetic response and return `INTERNAL_CACHE_NOOP`. Works with `set-status` 
to support any status code (defaults to 200 OK).
   
   **New test:** `header_rewrite_set_body_remap` -- replay-based autest 
verifying `set-body` + `set-status 403` at remap (origin skipped, 403 returned) 
and `set-body` without `set-status` (origin skipped, 200 OK returned).
   
   **Improved `set-body-from` tests:**
   - Added `SEND_RESPONSE_HDR_HOOK` test cases (previously untested despite the 
hook being supported)
   - Replaced fragile gold-file body comparisons with 
`ContainsExpression`/`ExcludesExpression` verification of status codes and body 
content
   - 5 test cases: `READ_RESPONSE_HDR` x {404, 200}, `SEND_RESPONSE_HDR` x 
{404, 200}, fetch-backend-unreachable
   
   **Documentation:** Updated `set-body` docs with a new "Synthetic responses" 
scenario and example showing `set-body` + `set-status` at `REMAP_PSEUDO_HOOK`.
   
   All three test suites pass on both regular and ASAN builds.


-- 
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]

Reply via email to