You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2017/11/28 23:55:50 UTC

[trafficserver] branch master updated: bugfix for malformed chunked response will be cached under some terrible network circumstances, clang-format code indent adjusted too!

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

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 9dae6f0  bugfix for malformed chunked response will be cached under some terrible network circumstances, clang-format code indent adjusted too!
9dae6f0 is described below

commit 9dae6f04f38096252fa6d967d549cf119b14a24a
Author: 陶云星 <ta...@le.com>
AuthorDate: Mon Oct 23 19:56:55 2017 +0800

    bugfix for malformed chunked response will be cached under some terrible network circumstances,
    clang-format code indent adjusted too!
---
 proxy/http/HttpSM.cc     | 14 +++++++++++++-
 proxy/http/HttpTunnel.cc |  6 +++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index f2a6f10..630e64b 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2975,7 +2975,19 @@ HttpSM::tunnel_handler_server(int event, HttpTunnelProducer *p)
         tunnel.append_message_to_producer_buffer(p, reason, reason_len);
         }
       */
-      tunnel.local_finish_all(p);
+      // add fix code for caching incompleted chunked response case under some terrible network circumstances
+      // disable cache write for the malformed chunked response
+      if ((p->do_dechunking || p->do_chunked_passthru) && p->chunked_handler.truncation) {
+        DebugSM("http", "[%" PRId64 "] [HttpSM::tunnel_handler_server] disable cache write due to server truncation but still send "
+                        "partial response to client",
+                sm_id);
+        tunnel.abort_cache_write_finish_others(p);
+        // We couldn't read all chunks successfully, disable keep-alive.
+        t_state.client_info.keep_alive     = HTTP_NO_KEEPALIVE;
+        t_state.current.server->keep_alive = HTTP_NO_KEEPALIVE;
+      } else {
+        tunnel.local_finish_all(p);
+      }
     }
     break;
 
diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index aecf2f5..9bc9f0c 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -1503,11 +1503,15 @@ HttpTunnel::finish_all_internal(HttpTunnelProducer *p, bool chain)
       if (chain == true && c->self_producer) {
         chain_finish_all(c->self_producer);
       }
+      // add fixed code for caching incompleted chunked response case under some terrible network circumstances
+      if (c->vc_type == HT_HTTP_CLIENT && p->chunked_handler.truncation == true) {
+        consumer_handler(VC_EVENT_EOS, c);
+      }
       // The IO Core will not call us back if there
       //   is nothing to do.  Check to see if there is
       //   nothing to do and take the appripriate
       //   action
-      if (c->write_vio && c->write_vio->nbytes == c->write_vio->ndone) {
+      else if (c->write_vio && c->write_vio->nbytes == c->write_vio->ndone) {
         consumer_handler(VC_EVENT_WRITE_COMPLETE, c);
       }
     }

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