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

commit a127d7ecb12dd9730635ad9c8bf85713253b5bb3
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Nov 6 16:10:24 2023 +0000

    HTTP methods are case sensitive - use consistent code for testing method
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 6 +++---
 java/org/apache/coyote/http2/Stream.java              | 2 +-
 java/org/apache/coyote/http2/StreamProcessor.java     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index a85c703d81..f252a4a0f6 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -586,7 +586,7 @@ public class CoyoteAdapter implements Adapter {
 
         // Check for ping OPTIONS * request
         if (undecodedURI.equals("*")) {
-            if (req.method().equalsIgnoreCase("OPTIONS")) {
+            if (req.method().equals("OPTIONS")) {
                 StringBuilder allow = new StringBuilder();
                 allow.append("GET, HEAD, POST, PUT, DELETE, OPTIONS");
                 // Trace if allowed
@@ -605,7 +605,7 @@ public class CoyoteAdapter implements Adapter {
         MessageBytes decodedURI = req.decodedURI();
 
         // Filter CONNECT method
-        if (req.method().equalsIgnoreCase("CONNECT")) {
+        if (req.method().equals("CONNECT")) {
             response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, 
sm.getString("coyoteAdapter.connect"));
         } else {
             // No URI for CONNECT requests
@@ -804,7 +804,7 @@ public class CoyoteAdapter implements Adapter {
         }
 
         // Filter TRACE method
-        if (!connector.getAllowTrace() && 
req.method().equalsIgnoreCase("TRACE")) {
+        if (!connector.getAllowTrace() && req.method().equals("TRACE")) {
             Wrapper wrapper = request.getWrapper();
             String header = null;
             if (wrapper != null) {
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index e2300d5129..f94bc3a46e 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -529,7 +529,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 
     final boolean receivedEndOfHeaders() throws ConnectionException {
         if (coyoteRequest.method().isNull() || coyoteRequest.scheme().isNull() 
||
-                !coyoteRequest.method().equalsIgnoreCase("CONNECT") && 
coyoteRequest.requestURI().isNull()) {
+                !coyoteRequest.method().equals("CONNECT") && 
coyoteRequest.requestURI().isNull()) {
             throw new 
ConnectionException(sm.getString("stream.header.required", getConnectionId(), 
getIdAsString()),
                     Http2Error.PROTOCOL_ERROR);
         }
diff --git a/java/org/apache/coyote/http2/StreamProcessor.java 
b/java/org/apache/coyote/http2/StreamProcessor.java
index be119cdd0d..bc5239b469 100644
--- a/java/org/apache/coyote/http2/StreamProcessor.java
+++ b/java/org/apache/coyote/http2/StreamProcessor.java
@@ -233,7 +233,7 @@ class StreamProcessor extends AbstractProcessor {
 
         // Exclude some HTTP header fields where the value is determined only
         // while generating the content as per section 9.3.2 of RFC 9110.
-        if (coyoteRequest != null && 
"HEAD".equals(coyoteRequest.method().toString())) {
+        if (coyoteRequest != null && coyoteRequest.method().equals("HEAD")) {
             headers.removeHeader("content-length");
             headers.removeHeader("content-range");
         }


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

Reply via email to