trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject trafficserver git commit: TS-3719: HPACK error in lowering table size
Date Fri, 26 Jun 2015 17:19:42 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/6.0.x f71f9f91a -> e2f90e377


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/e2f90e37
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e2f90e37
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e2f90e37

Branch: refs/heads/6.0.x
Commit: e2f90e377ddecda5237a10a1670ffdeacba3aad6
Parents: f71f9f9
Author: Bryan Call <bcall@apache.org>
Authored: Thu Jun 25 10:03:38 2015 -0700
Committer: Bryan Call <bcall@apache.org>
Committed: Fri Jun 26 10:17:02 2015 -0700

----------------------------------------------------------------------
 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/e2f90e37/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/e2f90e37/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 *


Mime
View raw message