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

commit a6a47dc7caf95fd076e58ed0b34f3a463e302623
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 7 15:00:59 2020 +0100

    Back-port NPE fix 8.5.x where trailer fields are handled differently.
---
 java/org/apache/coyote/http2/Stream.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index 116bbae..46719da 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -476,8 +476,14 @@ public class Stream extends AbstractStream implements 
HeaderEmitter {
                         "stream.header.unknownPseudoHeader", 
getConnectionId(), getIdentifier(),
                         name), Http2Error.PROTOCOL_ERROR, getIdAsInt());
             }
-            // Assume other HTTP header
-            coyoteRequest.getMimeHeaders().addValue(name).setString(value);
+
+            // Avoid NPE if Stream has been closed on Stream specific thread
+            Request coyoteRequest = this.coyoteRequest;
+            if (coyoteRequest != null) {
+                // HTTP/2 headers are already always lower case
+                // In 8.5.x trailer headers are added to headers collection.
+                coyoteRequest.getMimeHeaders().addValue(name).setString(value);
+            }
         }
         }
     }


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

Reply via email to