You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2015/05/22 21:58:17 UTC

trafficserver git commit: Fixed full request logic to mark complete.

Repository: trafficserver
Updated Branches:
  refs/heads/ts-974-5-3-x d5a3df4a9 -> ff379f67a


Fixed full request logic to mark complete.


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

Branch: refs/heads/ts-974-5-3-x
Commit: ff379f67a77c3e1da58b59e70f24f9537b3f4909
Parents: d5a3df4
Author: Alan M. Carroll <so...@yahoo-inc.com>
Authored: Fri May 22 14:57:55 2015 -0500
Committer: Alan M. Carroll <so...@yahoo-inc.com>
Committed: Fri May 22 14:57:55 2015 -0500

----------------------------------------------------------------------
 iocore/cache/CacheWrite.cc |  1 +
 proxy/hdrs/HTTP.h          | 13 +++++++++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ff379f67/iocore/cache/CacheWrite.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index 9901e5f..0bd829c 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -792,6 +792,7 @@ agg_copy(char *p, CacheVC *vc)
           int64_t size = vc->alternate.object_size_get();
           if (size >= 0) doc->total_len = size;
         } else {
+          // As the header is finalized the fragment vector should be trimmed if the object is complete.
           if (!vc->f.update && !vc->f.evac_vector) {
             ink_assert(!(vc->first_key == zero_key));
             CacheHTTPInfo *http_info = vc->write_vector->get(vc->alternate_index);

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/ff379f67/proxy/hdrs/HTTP.h
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HTTP.h b/proxy/hdrs/HTTP.h
index a892d8b..4aaf550 100644
--- a/proxy/hdrs/HTTP.h
+++ b/proxy/hdrs/HTTP.h
@@ -1941,6 +1941,19 @@ HTTPInfo::object_size_set(int64_t size)
 {
   m_alt->m_earliest.m_offset = size;
   m_alt->m_flag.content_length_p = true;
+  // Invariant - if a fragment is cached, all of that fragment is cached.
+  // Therefore if the last byte is in the initial cached fragments all of the data is cached.
+  if (!m_alt->m_flag.complete_p) {
+    int64_t mco = 0; // maximum cached offset + 1
+    if (m_alt->m_fragments) {
+      if (m_alt->m_fragments->m_cached_idx >= 0)
+	mco = this->get_frag_offset(m_alt->m_fragments->m_cached_idx) + this->get_frag_fixed_size();
+    } else if (m_alt->m_earliest.m_flag.cached_p) {
+      mco = this->get_frag_fixed_size();
+    }
+    if (mco > size)
+      m_alt->m_flag.complete_p = true;
+  }
 }
 
 inline HTTPInfo::FragmentDescriptorTable *