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

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

commit b0973cb14522481234366a3f361745d30c61d982
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Sep 11 12:33:19 2025 +0100

    Use constant for CONNECT
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 2 +-
 java/org/apache/coyote/http2/Stream.java              | 2 +-
 test/org/apache/coyote/http2/TestStreamProcessor.java | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java 
b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 2b4b59864c..6eccbdbc0f 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -617,7 +617,7 @@ public class CoyoteAdapter implements Adapter {
         MessageBytes decodedURI = req.decodedURI();
 
         // Filter CONNECT method
-        if ("CONNECT".equals(req.getMethod())) {
+        if (Method.CONNECT.equals(req.getMethod())) {
             response.sendError(HttpServletResponse.SC_NOT_IMPLEMENTED, 
sm.getString("coyoteAdapter.connect"));
         } else {
             // No URI for CONNECT requests
diff --git a/java/org/apache/coyote/http2/Stream.java 
b/java/org/apache/coyote/http2/Stream.java
index cf328662ec..ef9836605a 100644
--- a/java/org/apache/coyote/http2/Stream.java
+++ b/java/org/apache/coyote/http2/Stream.java
@@ -553,7 +553,7 @@ class Stream extends AbstractNonZeroStream implements 
HeaderEmitter {
 
     final boolean receivedEndOfHeaders() throws ConnectionException {
         if (coyoteRequest.getMethod() == null || 
coyoteRequest.scheme().isNull() ||
-                !"CONNECT".equals(coyoteRequest.getMethod()) && 
coyoteRequest.requestURI().isNull()) {
+                !Method.CONNECT.equals(coyoteRequest.getMethod()) && 
coyoteRequest.requestURI().isNull()) {
             throw new 
ConnectionException(sm.getString("stream.header.required", getConnectionId(), 
getIdAsString()),
                     Http2Error.PROTOCOL_ERROR);
         }
diff --git a/test/org/apache/coyote/http2/TestStreamProcessor.java 
b/test/org/apache/coyote/http2/TestStreamProcessor.java
index 09e52ba22c..7e08f5903f 100644
--- a/test/org/apache/coyote/http2/TestStreamProcessor.java
+++ b/test/org/apache/coyote/http2/TestStreamProcessor.java
@@ -577,7 +577,7 @@ public class TestStreamProcessor extends Http2TestBase {
         http2Connect();
 
         List<Header> headers = new ArrayList<>(4);
-        headers.add(new Header(":method", "CONNECT"));
+        headers.add(new Header(":method", Method.CONNECT));
         headers.add(new Header(":scheme", "http"));
         headers.add(new Header(":authority", "example.local"));
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to