You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/06/07 16:27:48 UTC

[trafficserver] 05/09: TS-4328 Not retry if any bytes were sent

This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit f15396674429853dc7f5bcac15cb1b4d671ebb39
Author: Thomas Jackson <ja...@apache.org>
AuthorDate: Wed Apr 6 18:58:36 2016 -0700

    TS-4328 Not retry if any bytes were sent
    
    Before we would still retry if the origin didn't error-- but just took a really long time. So, instead of only checking if the body was sent-- we can check the SM to see if we wrote any header bytes to the wire. If any bytes were sent the request cannot be retried.
    
    This closes #554
    
    This also deprecates the `request_body_start` field, and as such removes it
    
    (cherry picked from commit f129996e1adaab399359cd248f4750a686d6bfc5)
    
     Conflicts:
    	proxy/http/HttpTransact.h
---
 proxy/http/HttpSM.cc       |  1 -
 proxy/http/HttpTransact.cc | 10 +++++++---
 proxy/http/HttpTransact.h  |  4 +---
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index eabe0b5..2996250 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -5563,7 +5563,6 @@ HttpSM::do_setup_post_tunnel(HttpVC_t to_vc_type)
     IOBufferReader *buf_start = post_buffer->alloc_reader();
     int64_t post_bytes = chunked ? INT64_MAX : t_state.hdr_info.request_content_length;
 
-    t_state.hdr_info.request_body_start = true;
     // Note: Many browsers, Netscape and IE included send two extra
     //  bytes (CRLF) at the end of the post.  We just ignore those
     //  bytes since the sending them is not spec
diff --git a/proxy/http/HttpTransact.cc b/proxy/http/HttpTransact.cc
index b75850a..65dcc8a 100644
--- a/proxy/http/HttpTransact.cc
+++ b/proxy/http/HttpTransact.cc
@@ -6463,13 +6463,17 @@ HttpTransact::is_request_valid(State *s, HTTPHdr *incoming_request)
 
 // bool HttpTransact::is_request_retryable
 //
-//   If we started a POST/PUT tunnel then we can
-//    not retry failed requests
+// In the general case once bytes have been sent on the wire the request cannot be retried.
+// The reason we cannot retry is that the rfc2616 does not make any gaurantees about the
+// retry-ability of a request. In fact in the reverse proxy case it is quite common for GET
+// requests on the origin to fire tracking events etc. So, as a proxy once we have sent bytes
+// on the wire to the server we cannot gaurantee that the request is safe to redispatch to another server.
 //
 bool
 HttpTransact::is_request_retryable(State *s)
 {
-  if (s->hdr_info.request_body_start == true) {
+  // If the connection was established-- we cannot retry
+  if (s->state_machine->server_request_hdr_bytes > 0) {
     return false;
   }
 
diff --git a/proxy/http/HttpTransact.h b/proxy/http/HttpTransact.h
index 31f9c58..4fddf58 100644
--- a/proxy/http/HttpTransact.h
+++ b/proxy/http/HttpTransact.h
@@ -798,7 +798,6 @@ public:
     bool trust_response_cl;
     ResponseError_t response_error;
     bool extension_method;
-    bool request_body_start;
 
     _HeaderInfo()
       : client_request(),
@@ -814,8 +813,7 @@ public:
         client_req_is_server_style(false),
         trust_response_cl(false),
         response_error(NO_RESPONSE_HEADER_ERROR),
-        extension_method(false),
-        request_body_start(false)
+        extension_method(false)
     {
     }
   } HeaderInfo;

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.