trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject trafficserver git commit: TS-3495 Accept empty header field value
Date Sun, 05 Apr 2015 15:52:05 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master d48289055 -> 3f311ce3a


TS-3495 Accept empty header field value


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

Branch: refs/heads/master
Commit: 3f311ce3aae432e3679a8efe0fa54231abea87f6
Parents: d482890
Author: Masakazu Kitajo <m4sk17@gmail.com>
Authored: Sun Apr 5 09:51:16 2015 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Sun Apr 5 09:51:16 2015 -0600

----------------------------------------------------------------------
 CHANGES              |  3 +++
 proxy/http2/HPACK.cc |  2 +-
 proxy/http2/HTTP2.cc | 13 +++++++++++--
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3f311ce3/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ab5ccb8..a7b766c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 6.0.0
 
+  *) TS-3495: Accept empty header field value.
+   Author: Masakazu Kitajo <m4sk17@gmail.com>
+
   *) [TS-3482] Fill the first SETTINGS frame correctly.
    Author: Masakazu Kitajo <m4sk17@gmail.com>
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3f311ce3/proxy/http2/HPACK.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HPACK.cc b/proxy/http2/HPACK.cc
index e7f1326..f12d7e4 100644
--- a/proxy/http2/HPACK.cc
+++ b/proxy/http2/HPACK.cc
@@ -530,7 +530,7 @@ decode_string(Arena &arena, char **str, uint32_t &str_length,
const uint8_t *buf
   int64_t len = 0;
 
   len = decode_integer(encoded_string_len, p, buf_end, 7);
-  if (len == HPACK_ERROR_COMPRESSION_ERROR || encoded_string_len == 0)
+  if (len == HPACK_ERROR_COMPRESSION_ERROR)
     return HPACK_ERROR_COMPRESSION_ERROR;
   p += len;
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3f311ce3/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index f6d4842..4df3e5d 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -690,15 +690,24 @@ http2_parse_header_fragment(HTTPHdr *hdr, IOVec iov, Http2DynamicTable
&dynamic_
     int name_len = 0;
     const char *name = field->name_get(&name_len);
 
-    // ':' started header name is only allowed for psuedo headers
+    // ':' started header name is only allowed for pseudo headers
     if (hdr->fields_count() >= 4 && (name_len <= 0 || name[0] == ':')) {
       // Decoded header field is invalid
       return HPACK_ERROR_HTTP2_PROTOCOL_ERROR;
     }
 
+    // :path pseudo header MUST NOT empty for http or https URIs
+    if (name_len == HPACK_LEN_PATH && strncmp(name, HPACK_VALUE_PATH, name_len) ==
0) {
+      int value_len = 0;
+      field->value_get(&value_len);
+      if (value_len == 0) {
+        return HPACK_ERROR_HTTP2_PROTOCOL_ERROR;
+      }
+    }
+
     // when The TE header field is received, it MUST NOT contain any
     // value other than "trailers".
-    if (name_len == MIME_LEN_TE && strncmp(name, MIME_FIELD_TE, name_len) == 0) {
+    if (static_cast<unsigned>(name_len) == MIME_LEN_TE && strncmp(name, MIME_FIELD_TE,
name_len) == 0) {
       int value_len = 0;
       const char *value = field->value_get(&value_len);
       char trailers[] = "trailers";


Mime
View raw message