Repository: trafficserver
Updated Branches:
  refs/heads/master 9c84680a0 -> 5d38019f2


TS-2672: allow mime_hdr_field_detach to be called on detached MIME headers

Allow mime_hdr_field_detach() to be called on detached MIME headers
so that TSMimeHdrFieldDestroy() can be called on a field that has
been detached by TSMimeHdrFieldRemove(). This matches the behavior
of mime_hdr_field_attach(), which silently ignores calls to attach
fields that are not detached.


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

Branch: refs/heads/master
Commit: b92bbc1ed0cf2b0aef00531e2b9e03a9ef46f2e2
Parents: 9c84680
Author: James Peach <[email protected]>
Authored: Wed Mar 26 16:54:59 2014 -0700
Committer: James Peach <[email protected]>
Committed: Thu Mar 27 10:14:46 2014 -0700

----------------------------------------------------------------------
 CHANGES            | 2 ++
 proxy/hdrs/MIME.cc | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b92bbc1e/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index a60ef74..5e6e208 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.0.0
 
+  *) [TS-2672] TSMimeHdrFieldDestroy should not assert on removed fields.
+
   *) [TS-2554] New plugin: background_fetch, which under certain conditions
    will kick off a background fetch when it detects Range request and
    responses. This allows for the cache to start populating objects that would

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b92bbc1e/proxy/hdrs/MIME.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/MIME.cc b/proxy/hdrs/MIME.cc
index 0de0db2..a2b61c8 100644
--- a/proxy/hdrs/MIME.cc
+++ b/proxy/hdrs/MIME.cc
@@ -1517,8 +1517,14 @@ mime_hdr_field_detach(MIMEHdrImpl *mh, MIMEField *field, 
bool detach_all_dups)
 {
   MIMEField *next_dup = field->m_next_dup;
 
-  ink_assert(field->is_live());
+  // If this field is already detached, there's nothing to do. There must
+  // not be a dup list if we detached correctly.
+  if (field->m_readiness == MIME_FIELD_SLOT_READINESS_DETACHED) {
+    ink_assert(next_dup == NULL);
+    return;
+  }
 
+  ink_assert(field->is_live());
   MIME_HDR_SANITY_CHECK(mh);
 
   // Normally, this function is called with the current dup list head,

Reply via email to