You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2015/07/14 01:24:02 UTC

[2/2] trafficserver git commit: TS-3765: HTTP/2 issue sending headers with a duplicate name multiple times

TS-3765: HTTP/2 issue sending headers with a duplicate name multiple times


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

Branch: refs/heads/master
Commit: 32060ac42da24205ce8988a6941cb6d4df298d9c
Parents: bc85936
Author: Bryan Call <bc...@apache.org>
Authored: Mon Jul 13 16:21:40 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Mon Jul 13 16:21:40 2015 -0700

----------------------------------------------------------------------
 proxy/http2/HPACK.cc |  5 +++--
 proxy/http2/HTTP2.cc | 26 ++++++++++++--------------
 2 files changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/32060ac4/proxy/http2/HPACK.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index b074898..b37eef6 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -476,6 +476,7 @@ encode_literal_header_field(uint8_t *buf_start, const uint8_t *buf_end, const MI
 
   p += len;
 
+  Debug("http2_hpack_encode", "Encoded field: %.*s: %.*s", name_len, name, value_len, value);
   return p - buf_start;
 }
 
@@ -583,7 +584,7 @@ decode_indexed_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,
     const char *decoded_value = header.value_get(&decoded_value_len);
 
     Arena arena;
-    Debug("http2_hpack_decode", "Decoded field:  %s: %s\n", arena.str_store(decoded_name, decoded_name_len),
+    Debug("http2_hpack_decode", "Decoded field: %s: %s", arena.str_store(decoded_name, decoded_name_len),
           arena.str_store(decoded_value, decoded_value_len));
   }
 
@@ -667,7 +668,7 @@ decode_literal_header_field(MIMEFieldWrapper &header, const uint8_t *buf_start,
     int decoded_value_len;
     const char *decoded_value = header.value_get(&decoded_value_len);
 
-    Debug("http2_hpack_decode", "Decoded field:  %s: %s\n", arena.str_store(decoded_name, decoded_name_len),
+    Debug("http2_hpack_decode", "Decoded field: %s: %s", arena.str_store(decoded_name, decoded_name_len),
           arena.str_store(decoded_value, decoded_value_len));
   }
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/32060ac4/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 76017b3..bfb494c 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -622,21 +622,19 @@ http2_write_header_fragment(HTTPHdr *in, MIMEFieldIter &field_iter, uint8_t *out
     }
 
     MIMEFieldIter current_iter = field_iter;
-    do {
-      MIMEFieldWrapper header(field, in->m_heap, in->m_http->m_fields_impl);
-      if ((len = encode_literal_header_field(p, end, header, HPACK_FIELD_INDEXED_LITERAL)) == -1) {
-        if (!cont) {
-          // Parsing a part of headers is done
-          cont = true;
-          field_iter = current_iter;
-          return p - out;
-        } else {
-          // Parse error
-          return -1;
-        }
+    MIMEFieldWrapper header(field, in->m_heap, in->m_http->m_fields_impl);
+    if ((len = encode_literal_header_field(p, end, header, HPACK_FIELD_INDEXED_LITERAL)) == -1) {
+      if (!cont) {
+        // Parsing a part of headers is done
+        cont = true;
+        field_iter = current_iter;
+        return p - out;
+      } else {
+        // Parse error
+        return -1;
       }
-      p += len;
-    } while (field->has_dups() && (field = field->m_next_dup) != NULL);
+    }
+    p += len;
   }
 
   // Parsing all headers is done