You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by wb...@apache.org on 2015/01/30 20:02:50 UTC

trafficserver git commit: TS-1435 return full content if client is a multi range request

Repository: trafficserver
Updated Branches:
  refs/heads/master e5ac376b9 -> 5826e48fa


TS-1435 return full content if client is a multi range request


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

Branch: refs/heads/master
Commit: 5826e48fa9ed10b2cafdc8e9d4252309bbb31c9d
Parents: e5ac376
Author: Lars Svensson <la...@vmail.se>
Authored: Fri Jan 30 13:21:46 2015 -0500
Committer: William Bardwell <wb...@apache.org>
Committed: Fri Jan 30 13:21:46 2015 -0500

----------------------------------------------------------------------
 CHANGES              |  6 +++++-
 proxy/http/HttpSM.cc | 11 +++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5826e48f/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index bbc302f..14a8e40 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
-  *) [TS-3343] outbound transparent can end up with Connection: keep-alive hea
+  *) [TS-1435] return full content if client is a muti range request
+    Author: Lars Svensson <la...@vmail.se>
+
+  *) [TS-3343] outbound transparent can end up with Connection: keep-alive
+    headers on failures
 
   *) [TS-3351] Add basic pkg-config support.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/5826e48f/proxy/http/HttpSM.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 9f0b6a3..5954b6e 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -4321,7 +4321,7 @@ Lfaild:
 }
 
 void
-HttpSM::calculate_output_cl(int64_t content_length, int64_t num_chars)
+HttpSM::calculate_output_cl(int64_t num_chars_for_ct, int64_t num_chars_for_cl)
 {
   int i;
 
@@ -4338,9 +4338,9 @@ HttpSM::calculate_output_cl(int64_t content_length, int64_t num_chars)
     for (i = 0; i < t_state.num_range_fields; i++) {
       if (t_state.ranges[i]._start >= 0) {
         t_state.range_output_cl += boundary_size;
-        t_state.range_output_cl += sub_header_size + content_length;
+        t_state.range_output_cl += sub_header_size + num_chars_for_ct;
         t_state.range_output_cl += num_chars_for_int(t_state.ranges[i]._start)
-          + num_chars_for_int(t_state.ranges[i]._end) + num_chars + 2;
+          + num_chars_for_int(t_state.ranges[i]._end) + num_chars_for_cl + 2;
         t_state.range_output_cl += t_state.ranges[i]._end - t_state.ranges[i]._start + 1;
         t_state.range_output_cl += 2;
       }
@@ -4355,11 +4355,14 @@ HttpSM::calculate_output_cl(int64_t content_length, int64_t num_chars)
 void
 HttpSM::do_range_parse(MIMEField *range_field)
 {
+  int num_chars_for_ct = 0;
+  t_state.cache_info.object_read->response_get()->value_get(MIME_FIELD_CONTENT_TYPE, MIME_LEN_CONTENT_TYPE, &num_chars_for_ct);
+
   int64_t content_length   = t_state.cache_info.object_read->object_size_get();
   int64_t num_chars_for_cl = num_chars_for_int(content_length);
 
   parse_range_and_compare(range_field, content_length);
-  calculate_output_cl(content_length, num_chars_for_cl);
+  calculate_output_cl(num_chars_for_ct, num_chars_for_cl);
 }
 
 // this function looks for any Range: headers, parses them and either