You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2020/06/19 05:12:21 UTC

[trafficserver] branch master updated: Fix old MIMEHdr handling of HPACK

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

masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


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

commit c2d6405b19a7b3234b74221f281f687955da81bd
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
---
 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) {