This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 027071c  Better error for empty header name
027071c is described below

commit 027071c96e838d9aa9c4510ccf31361c690b84cc
Author: remm <r...@apache.org>
AuthorDate: Mon Apr 29 13:30:06 2019 +0200

    Better error for empty header name
---
 java/org/apache/coyote/http2/LocalStrings.properties | 1 +
 java/org/apache/coyote/http2/Stream.java             | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/java/org/apache/coyote/http2/LocalStrings.properties 
b/java/org/apache/coyote/http2/LocalStrings.properties
index 3707435..9c34e93 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -80,6 +80,7 @@ stream.header.connection=Connection [{0}], Stream [{1}], HTTP 
header [connection
 stream.header.contentLength=Connection [{0}], Stream [{1}], The content length 
header value [{2}] does not agree with the size of the data received [{3}]
 stream.header.debug=Connection [{0}], Stream [{1}], HTTP header [{2}], Value 
[{3}]
 stream.header.duplicate=Connection [{0}], Stream [{1}], received multiple 
[{3}] headers
+stream.header.empty=Connection [{0}], Stream [{1}], Invalid empty header name
 stream.header.invalid=Connection [{0}], Stream [{1}], The header [{2}] 
contained invalid value [{3}]
 stream.header.noPath=Connection [{0}], Stream [{1}], The [:path] pseudo header 
was empty
 stream.header.required=Connection [{0}], Stream [{1}], One or more required 
headers was missing
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 9d8bcbe..116bbae 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -367,6 +367,11 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
             return;
         }
 
+        if (name.length() == 0) {
+            throw new HpackException(sm.getString("stream.header.empty",
+                    getConnectionId(), getIdentifier()));
+        }
+
         boolean pseudoHeader = name.charAt(0) == ':';
 
         if (pseudoHeader && headerState != HEADER_STATE_PSEUDO) {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to