trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [1/2] trafficserver git commit: TS-3565 Only start up the continuation from DoRemap if the request has a Range: header
Date Mon, 11 May 2015 21:59:57 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 02bfcb3eb -> dcb5baa08


TS-3565 Only start up the continuation from DoRemap if the request has a Range: header


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/51cbfa90
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/51cbfa90
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/51cbfa90

Branch: refs/heads/master
Commit: 51cbfa902a4726f72003bc943641dc5a9b596d0a
Parents: 02bfcb3
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Tue Apr 28 18:17:06 2015 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Mon May 11 15:58:46 2015 -0600

----------------------------------------------------------------------
 .../background_fetch/background_fetch.cc        | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/51cbfa90/plugins/experimental/background_fetch/background_fetch.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/background_fetch/background_fetch.cc b/plugins/experimental/background_fetch/background_fetch.cc
index e5cdb6b..780de5c 100644
--- a/plugins/experimental/background_fetch/background_fetch.cc
+++ b/plugins/experimental/background_fetch/background_fetch.cc
@@ -640,13 +640,24 @@ TSRemapDoRemap(void *ih, TSHttpTxn txnp, TSRemapRequestInfo * /* rri
*/)
     return TSREMAP_NO_REMAP;
   }
 
-  BgFetchConfig *config = static_cast<BgFetchConfig *>(ih);
+  TSMBuffer bufp;
+  TSMLoc req_hdrs;
 
-  config->acquire(); // Inc refcount
-  TSHttpTxnHookAdd(txnp, TS_HTTP_READ_RESPONSE_HDR_HOOK, config->getCont());
-  TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, config->getCont());
+  if (TS_SUCCESS == TSHttpTxnClientReqGet(txnp, &bufp, &req_hdrs)) {
+    TSMLoc field_loc = TSMimeHdrFieldFind(bufp, req_hdrs, TS_MIME_FIELD_RANGE, TS_MIME_LEN_RANGE);
+
+    if (field_loc) {
+      BgFetchConfig *config = static_cast<BgFetchConfig *>(ih);
 
-  TSDebug(PLUGIN_NAME, "background fetch TSRemapDoRemap...");
+      config->acquire(); // Inc refcount
+      TSHttpTxnHookAdd(txnp, TS_HTTP_READ_RESPONSE_HDR_HOOK, config->getCont());
+      TSHttpTxnHookAdd(txnp, TS_HTTP_TXN_CLOSE_HOOK, config->getCont());
+
+      TSDebug(PLUGIN_NAME, "background fetch TSRemapDoRemap...");
+      TSHandleMLocRelease(bufp, req_hdrs, field_loc);
+    }
+    TSHandleMLocRelease(bufp, TS_NULL_MLOC, req_hdrs);
+  }
 
   return TSREMAP_NO_REMAP;
 }


Mime
View raw message