trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [4/6] trafficserver git commit: TS-3495 Accept empty header field value
Date Mon, 06 Apr 2015 16:45:14 GMT
TS-3495 Accept empty header field value

(cherry picked from commit 3f311ce3aae432e3679a8efe0fa54231abea87f6)

Conflicts:
	CHANGES


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

Branch: refs/heads/5.3.x
Commit: 3566048af56f74d48ededb978f39969f33fa3b11
Parents: f810c09
Author: Masakazu Kitajo <m4sk17@gmail.com>
Authored: Sun Apr 5 09:51:16 2015 -0600
Committer: Phil Sorber <sorber@apache.org>
Committed: Mon Apr 6 10:37:20 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/3566048a/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index def7f30..53ebc96 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) TS-3495: Accept empty header field value.
+   Author: Masakazu Kitajo <m4sk17@gmail.com>
+
   *) [TS-3475] Add a few records.config options for controlling the HTTP/2
    SETTINGS. Thanks to Masakazu for all the reviews and additions.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/3566048a/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/3566048a/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index 55f4f81..3d966d8 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -691,15 +691,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