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

   ### Correction: summary of all three commits in this PR
   
   **Commit 1: Allow set-body to replace origin server response bodies**
   
   Added `internal_msg_buffer` checks in `HttpSM::handle_api_return()` for the 
`SERVER_READ` and `TRANSFORM_READ` states. When a plugin sets a body via 
`TSHttpTxnErrorBodySet()` at `READ_RESPONSE_HDR_HOOK` or 
`SEND_RESPONSE_HDR_HOOK`, ATS now diverts to `setup_internal_transfer()` 
instead of tunneling the origin body. Drains the origin body when possible to 
allow connection reuse. Includes replay-based `header_rewrite_set_body_origin` 
test covering both hooks, 200/403 status codes, and empty origin bodies.
   
   **Commit 2: Standardize set-body-from to preserve origin response headers**
   
   Changed `set-body-from`'s successful fetch handler to reenable with 
`TS_EVENT_HTTP_CONTINUE` instead of `TS_EVENT_HTTP_ERROR`. This preserves the 
origin's status code and headers (previously it returned 500 INKApi Error). 
Removed the `TSHttpTxnStatusSet()` workaround. Added `SEND_RESPONSE_HDR_HOOK` 
support. Updated documentation.
   
   **Commit 3: Skip origin connection when set-body is used at remap hook**
   
   When `set-body` is used at a pre-origin hook like `REMAP_PSEUDO_HOOK`, ATS 
now skips the origin connection entirely. Added a single `internal_msg_buffer` 
check at the top of `how_to_open_connection()` -- if the buffer is set, build a 
synthetic response and return `INTERNAL_CACHE_NOOP`. Works with `set-status` 
for any status code (defaults to 200 OK).
   
   New `header_rewrite_set_body_remap` replay-based test verifying origin is 
skipped with both `set-status 403` and default 200.
   
   Rewrote `header_rewrite_set_body_from` tests:
   - Added `SEND_RESPONSE_HDR_HOOK` tests (previously untested despite the hook 
being added in commit 2)
   - Replaced fragile gold-file 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
   
   Updated `set-body` documentation with new "Synthetic responses" scenario and 
example.
   
   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