Re: Request.getParameter(String s) doesn't parse parameters

Mark Thomas <[email protected]>
Newsgroups gmane.comp.jakarta.tomcat.user
Message-ID <[email protected]>
On 07/01/2026 19:45, Nelson Page via users wrote:
> Hi all -
> 
> First time mailing on this list, please let me know what I can improve.
> 
> I've run into a case where
> org.apache.catalina.connector.Request.getParameter("some_parameter")
> no longer results in the parameters getting parsed.
> 
> We're on tomcat 9.0.107, using HTTP/2, the `content-length` header is
> not being set, the `content-type` header is set to
> `application/x-www-form-urlencoded`, and the HTTP method is `POST`.
> 
> So I think what happens is in
> https://github.com/apache/tomcat/blob/9.0.x/java/org/apache/catalina/connector/Request.java#L3094
> the `len` variable is set to -1, and we fall out in the `if` statement
> below it.
> 
> Is this expected behavior?

No.

I'd need to write a test case to confirm the behaviour but that looks 
like a bug.

HTTP/2 requests are not required to provide a content-length since the 
HTTP/2 framing defines where the body (if any) ends.

The fix is probably changing "...else if chunked..." to "...else if 
chunked or HTTP/2..."

We should be able to fix this for the January releases (they are a 
little behind the usual schedule as we need to get some Tomcat Native 
releases completed first).

If you (or anyone else) wanted to help this along any of the following 
would help. Ideally, we'd have all of these in this order but any help 
with any of them would be useful.

1. A bug for this in Bugzilla (Tomcat version isn't that important).

2. A test case attached to the BZ issue in the form of a patch to the 
Tomcat unit tests that demonstrates the issue. There should be examples 
of all the parts required in the existing tests cases. This should 
mostly be copy/paste. A GitHub PR also works.

3. A patch (or pull request) that fixes the issue and causes the test 
case in 2 to pass.

Cheers,

Mark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.