You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2015/07/21 13:49:41 UTC

trafficserver git commit: TS-3595: Cookie header split into multiple lines with H2 Use HeadGuard instead

Repository: trafficserver
Updated Branches:
  refs/heads/master acc4552b4 -> 3184b5521


TS-3595: Cookie header split into multiple lines with H2
Use HeadGuard instead


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

Branch: refs/heads/master
Commit: 3184b55211f24276f9b439787ab8e9fba450c899
Parents: acc4552
Author: Bryan Call <bc...@apache.org>
Authored: Tue Jul 21 13:36:09 2015 +0200
Committer: Bryan Call <bc...@apache.org>
Committed: Tue Jul 21 13:36:09 2015 +0200

----------------------------------------------------------------------
 proxy/hdrs/MIME.h | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3184b552/proxy/hdrs/MIME.h
----------------------------------------------------------------------
diff --git a/proxy/hdrs/MIME.h b/proxy/hdrs/MIME.h
index 7b73429..a3c6177 100644
--- a/proxy/hdrs/MIME.h
+++ b/proxy/hdrs/MIME.h
@@ -1333,25 +1333,17 @@ inline void
 MIMEHdr::field_combine_dups(MIMEField *field, bool prepend_comma, const char separator)
 {
   MIMEField *current = field->m_next_dup;
-  MIMEField *next = NULL;
-
-  // clean up the heaps so we don't run this in the middle of appending and moving source location
-  m_heap->coalesce_str_heaps();
 
   while (current) {
-    next = current->m_next_dup;
-
     int value_len = 0;
     const char *value_str = current->value_get(&value_len);
+
     if (value_len > 0) {
+      HdrHeap::HeapGuard guard(m_heap, value_str); // reference count the source string so it doesn't get moved
       field->value_append(m_heap, m_mime, value_str, value_len, prepend_comma, separator);
     }
-    current = next;
-  }
-
-  // save the deletes to the end so we don't call coalesce_str_heaps in the middle of the appends
-  if (field->m_next_dup) {
-    field_delete(field->m_next_dup, true); // delete the duplicates
+    field_delete(current, false); // don't delete duplicates
+    current = field->m_next_dup;
   }
 }