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:01 UTC

[1/2] trafficserver git commit: TS-3764: HTTP/2 issue when sending header frames larger than one frame

Repository: trafficserver
Updated Branches:
  refs/heads/master 6c4c7226e -> 32060ac42


TS-3764: HTTP/2 issue when sending header frames larger than one frame


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

Branch: refs/heads/master
Commit: bc859360c8de4ced65befd59e54a28b023331b29
Parents: 6c4c722
Author: Bryan Call <bc...@apache.org>
Authored: Mon Jul 13 15:55:27 2015 -0700
Committer: Bryan Call <bc...@apache.org>
Committed: Mon Jul 13 15:55:27 2015 -0700

----------------------------------------------------------------------
 proxy/http2/Http2ConnectionState.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/bc859360/proxy/http2/Http2ConnectionState.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index c085f67..c45ee32 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -112,7 +112,7 @@ rcv_data_frame(Http2ClientSession &cs, Http2ConnectionState &cstate, const Http2
     return HTTP2_ERROR_NO_ERROR;
   }
 
-  // Check whether Window Size is appeptable.
+  // Check whether Window Size is acceptable
   if (cstate.server_rwnd < payload_length || stream->server_rwnd < payload_length) {
     return HTTP2_ERROR_FLOW_CONTROL_ERROR;
   }
@@ -890,10 +890,10 @@ Http2ConnectionState::send_headers_frame(FetchSM *fetch_sm)
   Http2Stream *stream = static_cast<Http2Stream *>(fetch_sm->ext_get_user_data());
   HTTPHdr *resp_header = reinterpret_cast<HTTPHdr *>(fetch_sm->resp_hdr_bufp());
 
-  // Write psuedo headers
+  // Write pseudo headers
   payload_length += http2_write_psuedo_headers(resp_header, payload_buffer, buf_len, *(this->remote_dynamic_table));
 
-  // If response body is empry, set END_STREAM flag to HEADERS frame
+  // If response body is empty, set END_STREAM flag to HEADERS frame
   // Must check to ensure content-length is there.  Otherwise the value defaults to 0
   if (resp_header->presence(MIME_PRESENCE_CONTENT_LENGTH) && resp_header->get_content_length() == 0) {
     flags |= HTTP2_FLAGS_HEADERS_END_STREAM;
@@ -923,6 +923,8 @@ Http2ConnectionState::send_headers_frame(FetchSM *fetch_sm)
     // xmit event
     SCOPED_MUTEX_LOCK(lock, this->ua_session->mutex, this_ethread());
     this->ua_session->handleEvent(HTTP2_SESSION_EVENT_XMIT, &headers);
+
+    payload_length = 0; // we will reuse the same buffer for more headers
   } while (cont);
 }
 


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

Posted by bc...@apache.org.
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