You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/07/05 16:34:18 UTC

[tomcat] branch main updated: Remove unnecessary code

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 8518c54fba Remove unnecessary code
8518c54fba is described below

commit 8518c54fba7edf91c87df4664d7cb20457e4b37d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jul 5 17:34:03 2023 +0100

    Remove unnecessary code
    
    Dead code identified by Coverity Scan
---
 java/org/apache/coyote/http2/StreamProcessor.java | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/coyote/http2/StreamProcessor.java b/java/org/apache/coyote/http2/StreamProcessor.java
index 78cb770649..01f5e224ec 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -512,17 +512,12 @@ class StreamProcessor extends AbstractProcessor {
         }
 
         // HTTP header names must be tokens.
+        // Stream#emitHeader() checks that all the pseudo headers appear first.
         MimeHeaders headers = request.getMimeHeaders();
-        boolean previousHeaderWasPseudoHeader = true;
         Enumeration<String> names = headers.names();
         while (names.hasMoreElements()) {
             String name = names.nextElement();
-            if (H2_PSEUDO_HEADERS_REQUEST.contains(name)) {
-                if (!previousHeaderWasPseudoHeader) {
-                    return false;
-                }
-            } else if (!HttpParser.isToken(name)) {
-                previousHeaderWasPseudoHeader = false;
+            if (!H2_PSEUDO_HEADERS_REQUEST.contains(name) && !HttpParser.isToken(name)) {
                 return false;
             }
         }


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