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

[6/8] trafficserver git commit: TS-3719: HPACK error in lowering table size

TS-3719: HPACK error in lowering table size

(cherry picked from commit 96bd1fa785c3e6adbca8e11f1ad7a578e945625e)


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

Branch: refs/heads/5.3.x
Commit: 4281f20ad9e9316710d427628250ce58bd15ea09
Parents: 81a6807
Author: Bryan Call <bc...@apache.org>
Authored: Thu Jun 25 10:03:38 2015 -0700
Committer: Phil Sorber <so...@apache.org>
Committed: Mon Jun 29 13:48:09 2015 -0600

----------------------------------------------------------------------
 proxy/http2/HPACK.cc | 15 ++++++++++-----
 proxy/http2/HPACK.h  |  2 +-
 2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4281f20a/proxy/http2/HPACK.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index 4dd4eb0..b074898 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -210,23 +210,26 @@ Http2DynamicTable::get_header_from_indexing_tables(uint32_t index, MIMEFieldWrap
 // Whenever the maximum size for the header table is reduced, entries
 // are evicted from the end of the header table until the size of the
 // header table is less than or equal to the maximum size.
-void
+bool
 Http2DynamicTable::set_dynamic_table_size(uint32_t new_size)
 {
-  uint32_t old_size = _settings_dynamic_table_size;
-  while (old_size > new_size) {
+  while (_current_size > new_size) {
+    if (_headers.n <= 0) {
+      return false;
+    }
     int last_name_len, last_value_len;
     MIMEField *last_field = _headers.last();
 
     last_field->name_get(&last_name_len);
     last_field->value_get(&last_value_len);
-    old_size -= ADDITIONAL_OCTETS + last_name_len + last_value_len;
+    _current_size -= ADDITIONAL_OCTETS + last_name_len + last_value_len;
 
     _headers.remove_index(_headers.length() - 1);
     _mhdr->field_delete(last_field, false);
   }
 
   _settings_dynamic_table_size = new_size;
+  return true;
 }
 
 void
@@ -684,7 +687,9 @@ update_dynamic_table_size(const uint8_t *buf_start, const uint8_t *buf_end, Http
   if (len == HPACK_ERROR_COMPRESSION_ERROR)
     return HPACK_ERROR_COMPRESSION_ERROR;
 
-  dynamic_table.set_dynamic_table_size(size);
+  if (dynamic_table.set_dynamic_table_size(size) == false) {
+    return HPACK_ERROR_COMPRESSION_ERROR;
+  }
 
   return len;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/4281f20a/proxy/http2/HPACK.h
----------------------------------------------------------------------
diff --git a/proxy/http2/HPACK.h b/proxy/http2/HPACK.h
index ea1e211..4e63a37 100644
--- a/proxy/http2/HPACK.h
+++ b/proxy/http2/HPACK.h
@@ -113,7 +113,7 @@ public:
 
   void add_header_field(const MIMEField *field);
   int get_header_from_indexing_tables(uint32_t index, MIMEFieldWrapper &header_field) const;
-  void set_dynamic_table_size(uint32_t new_size);
+  bool set_dynamic_table_size(uint32_t new_size);
 
 private:
   const MIMEField *