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

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


The following commit(s) were added to refs/heads/11.0.x by this push:
     new 2a7d067cf8 Review "Restore the raw HTTP method token for methods 
unknown to Tomcat"
2a7d067cf8 is described below

commit 2a7d067cf81a29097e342d4c333960e4a48ab373
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Oct 30 21:09:34 2026 +0000

    Review "Restore the raw HTTP method token for methods unknown to Tomcat"
    
    Additional method validation
---
 java/org/apache/coyote/http11/Http11InputBuffer.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/java/org/apache/coyote/http11/Http11InputBuffer.java 
b/java/org/apache/coyote/http11/Http11InputBuffer.java
index 9ba91b03f7..868cee22e6 100644
--- a/java/org/apache/coyote/http11/Http11InputBuffer.java
+++ b/java/org/apache/coyote/http11/Http11InputBuffer.java
@@ -389,6 +389,12 @@ public class Http11InputBuffer implements InputBuffer, 
ApplicationBufferHandler,
                 int pos = byteBuffer.position();
                 chr = byteBuffer.get();
                 if (chr == Constants.SP || chr == Constants.HT) {
+                    if (pos == parsingRequestLineStart) {
+                        // No method
+                        // Avoid unknown protocol triggering an additional 
error
+                        request.protocol().setString(Constants.HTTP_11);
+                        throw new 
IllegalArgumentException(sm.getString("iib.invalidmethod", ""));
+                    }
                     space = true;
                     request.setMethod(byteBuffer.array(), 
parsingRequestLineStart, pos - parsingRequestLineStart);
                 } else if (!HttpParser.isToken(chr)) {


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

Reply via email to