Copilot commented on code in PR #13820:
URL: https://github.com/apache/trafficserver/pull/13820#discussion_r4436951703


##########
src/proxy/http/HttpTransact.cc:
##########
@@ -7063,11 +7065,15 @@ HttpTransact::is_request_retryable(State *s)
     return false;
   }
 
-  // If safe requests are  retryable, it should be safe to retry safe requests 
irrespective of bytes sent or connection state
-  // according to RFC the following methods are safe 
(https://tools.ietf.org/html/rfc7231#section-4.2.1)
+  // Safe methods (RFC 9110, section 9.2.1) can be retried irrespective of 
bytes sent or connection state. QUERY
+  // (draft-ietf-httpbis-safe-method-w-body) is safe too, but its content is 
not kept for replay on this path, so once
+  // any part of its request has been sent it is treated like an unsafe 
method, whether or not the content itself went
+  // out. A buffered QUERY can still be retried when the origin reports it was 
not processed, see
+  // HttpSM::prepare_for_origin_retry.
   // Otherwise, if there was no error establishing the connection (and we sent 
bytes)-- we cannot retry
-  if (!HttpTransactHeaders::is_method_safe(s->method) && s->current.state != 
CONNECTION_ERROR &&
-      s->state_machine->server_request_hdr_bytes > 0) {
+  bool const retry_only_before_sending = 
!HttpTransactHeaders::is_method_safe(s->method) || s->method == 
HTTP_WKSIDX_QUERY;
+
+  if (retry_only_before_sending && s->current.state != CONNECTION_ERROR && 
s->state_machine->server_request_hdr_bytes > 0) {

Review Comment:
   After a completed unbuffered QUERY upload, an origin-side TLS read error 
reaches `handle_server_setup_error(VC_EVENT_ERROR)`, which sets 
`CONNECTION_ERROR` without checking body replayability. This exception then 
permits a retry with an exhausted body reader, so ATS cannot resend the content 
promised by the request headers. Gate post-upload QUERY retries on body 
replayability while preserving pre-send failures and explicitly admitted 
not-processed retries, and add a TLS-error regression case.



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