This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new fa43440 Better error for empty header name
fa43440 is described below
commit fa43440991fdb5d088a6417425cd18a80ba2cf71
Author: remm <[email protected]>
AuthorDate: Mon Apr 29 13:30:06 2019 +0200
Better error for empty header name
Also add back logging for a while.
---
conf/logging.properties | 2 +-
java/org/apache/coyote/http2/LocalStrings.properties | 1 +
java/org/apache/coyote/http2/Stream.java | 7 ++++++-
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/conf/logging.properties b/conf/logging.properties
index e8b7b16..fc52083 100644
--- a/conf/logging.properties
+++ b/conf/logging.properties
@@ -73,7 +73,7 @@
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].ha
#org.apache.jasper.compiler.TldLocationsCache.level = FINE
# To see debug messages for HTTP/2 handling, uncomment the following line:
-#org.apache.coyote.http2.level = FINE
+org.apache.coyote.http2.level = FINE
# To see debug messages for WebSocket handling, uncomment the following line:
#org.apache.tomcat.websocket.level = FINE
diff --git a/java/org/apache/coyote/http2/LocalStrings.properties
b/java/org/apache/coyote/http2/LocalStrings.properties
index 17dbf88..b2ac336 100644
--- a/java/org/apache/coyote/http2/LocalStrings.properties
+++ b/java/org/apache/coyote/http2/LocalStrings.properties
@@ -83,6 +83,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 0bb12a0..21304d9 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -347,6 +347,11 @@ 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) {
@@ -361,7 +366,7 @@ class Stream extends AbstractStream implements
HeaderEmitter {
headerState = HEADER_STATE_REGULAR;
}
- switch(name) {
+ switch (name) {
case ":method": {
if (coyoteRequest.method().isNull()) {
coyoteRequest.method().setString(value);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]