JakeChampion opened a new pull request, #14109:
URL: https://github.com/apache/trafficserver/pull/14109

   This PR is the follow-up from the review of #14028. It is stacked on that 
PR, so the base branch is `jake/query-method`. Only the last commit is new.
   
   ## Problem
   
   When ATS has sent the header and the content of a `POST` or `PUT`, the 
origin can fail the connection with a read error (for example, a TLS read 
error) before it answers. `handle_server_setup_error()` then sets the state to 
`CONNECTION_ERROR`, and `is_request_retryable()` permits a retry for that state.
   
   The request content is not available again at that point. ATS sends the 
request header to the origin a second time without the content. The origin 
waits for content that does not come, and the client gets a 502 only after the 
origin stops the wait. This occurs with 
`proxy.config.http.request_buffer_enabled` at 0 and at 1.
   
   ## Change
   
   #14028 added a guard for `QUERY` in the `VC_EVENT_ERROR` branch of 
`handle_server_setup_error()`. This PR applies the same guard to each request 
that sent content to the origin:
   
   - If ATS wrote request header bytes and sent content, the state is 
`CONNECTION_CLOSED`, unless `prepare_for_origin_retry()` admits the retry.
   - `prepare_for_origin_retry()` admits a retry only when the origin reports 
that it did not process the request and ATS has a complete copy of the content.
   - If ATS wrote no header bytes, or the request has no content, the behavior 
does not change.
   
   ## Tests
   
   - `test_query_retry.py` now also runs with `POST` and `PUT`, with and 
without request buffering. Without the fix, the four TLS read error cases fail: 
the origin gets the request header two times. With the fix, all cases pass.
   - `test_HttpSM.cc` has a new case for `POST` and `PUT`. It fails without the 
fix.
   


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