Dimitrius, I might be -1 on this. I've reopened BZ 69918 for discussion.
-chris On 1/12/26 5:57 AM, [email protected] wrote:
This is an automated email from the ASF dual-hosted git repository. dsoumis 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 e5e85ee48b Fix BZ 69918 - Ensure request parameters are correctly parsed for HTTP/2 requests when the content-length header is not set. e5e85ee48b is described below commit e5e85ee48b41c55ca44c87a14b57a90d0fe98a61 Author: Dimitrios Soumis <[email protected]> AuthorDate: Mon Jan 12 12:56:58 2026 +0200 Fix BZ 69918 - Ensure request parameters are correctly parsed for HTTP/2 requests when the content-length header is not set. --- java/org/apache/catalina/connector/Request.java | 3 +- .../coyote/http2/TestHttp2RequestParameters.java | 52 ++++++++++++++++++++++ webapps/docs/changelog.xml | 4 ++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index e718452fb3..430e0d29c2 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -2876,7 +2876,8 @@ public class Request implements HttpServletRequest { return; } parameters.processParameters(formData, 0, len); - } else if ("chunked".equalsIgnoreCase(coyoteRequest.getHeader("transfer-encoding"))) { + } else if (coyoteRequest.protocol().equals("HTTP/2.0") + || "chunked".equalsIgnoreCase(coyoteRequest.getHeader("transfer-encoding"))) { byte[] formData = null; try { formData = readChunkedPostBody(); diff --git a/test/org/apache/coyote/http2/TestHttp2RequestParameters.java b/test/org/apache/coyote/http2/TestHttp2RequestParameters.java new file mode 100644 index 0000000000..9dbc332461 --- /dev/null +++ b/test/org/apache/coyote/http2/TestHttp2RequestParameters.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.coyote.http2; + +import org.junit.Assert; +import org.junit.Test; + +import org.apache.catalina.connector.Request; + +public class TestHttp2RequestParameters extends Http2TestBase { + /** + * Test case for https://bz.apache.org/bugzilla/show_bug.cgi?id=69918 POST parameters are not returned from a call + * to any of the {@link Request} getParameterXXX() methods if the request is HTTP/2 and the + * content-length header is not set. + */ + @Test + public void testBug69918() throws Exception { + http2Connect(); + + sendParameterPostRequest(3, null, "a=1&b=2", -1, false); + output.setTraceBody(true); + + boolean foundBody = false; + while (parser.readFrame()) { + String trace = output.getTrace(); + if (trace.contains("3-Body-2")) { + foundBody = true; + } else if (trace.contains("3-Body-0")) { + Assert.fail("Parameter count was 0. Trace: " + trace); + } + if (trace.contains("3-EndOfStream")) { + break; + } + } + Assert.assertTrue("Parameter count should be 2, trace: " + output.getTrace(), foundBody); + } +} diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 2ee830f4be..a2270309eb 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -201,6 +201,10 @@ Pull request <pr>923</pr>: Avoid adding multiple CSRF tokens to a URL in the <code>CsrfPreventionFilter</code>. (schultz) </fix> + <fix> + <bug>69918</bug>: Ensure request parameters are correctly parsed for HTTP/2 requests + when the content-length header is not set. (dsoumis) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
