You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2020/06/23 20:14:40 UTC

[trafficserver] branch 8.1.x updated: Fix old MIMEHdr handling of HPACK

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
     new ae4bf85  Fix old MIMEHdr handling of HPACK
ae4bf85 is described below

commit ae4bf85dc5086667e505bc270ff61c0dde0d68ad
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Fri May 8 12:27:44 2020 +0900

    Fix old MIMEHdr handling of HPACK
    
    1. Clear all MIMEFields from old MIMEHdr when new entry is larger than the maximum size
    2. Delete MIMEFields from old MIMEHdr on eviction
    
    (cherry picked from commit c2d6405b19a7b3234b74221f281f687955da81bd)
---
 proxy/http2/HPACK.cc | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index 97a2626..774ed2e 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -372,6 +372,14 @@ HpackDynamicTable::add_header_field(const MIMEField *field)
     // table causes the table to be emptied of all existing entries.
     this->_headers.clear();
     this->_mhdr->fields_clear();
+
+    if (this->_mhdr_old) {
+      this->_mhdr_old->fields_clear();
+      this->_mhdr_old->destroy();
+      delete this->_mhdr_old;
+      this->_mhdr_old = nullptr;
+    }
+
     this->_current_size = 0;
   } else {
     this->_current_size += header_size;
@@ -430,7 +438,13 @@ HpackDynamicTable::_evict_overflowed_entries()
     (*h)->value_get(&value_len);
 
     this->_current_size -= ADDITIONAL_OCTETS + name_len + value_len;
-    this->_mhdr->field_delete(*h, false);
+
+    if (this->_mhdr_old && this->_mhdr_old->fields_count() != 0) {
+      this->_mhdr_old->field_delete(*h, false);
+    } else {
+      this->_mhdr->field_delete(*h, false);
+    }
+
     this->_headers.pop_back();
 
     if (this->_current_size <= this->_maximum_size) {