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

Rémy Maucherat <[email protected]>
Newsgroups gmane.comp.jakarta.tomcat.user
Message-ID <CANwj8Zqkuuq0rn8hcwS369GWctnZ51E3p52eiqLq=6jBCOgcRg@mail.gmail.com>
On Thu, Jan 8, 2026 at 11:17 AM Mark Thomas <[email protected]> wrote:
>
> 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.

It's not a regression though:
https://github.com/apache/tomcat/commit/19aada70628d49cf8ff1b0230cd87ec289d5c592
added POST support for chunked, but it previously always required a >
0 content length (since it's a much simpler and more efficient
scenario).

So I disagree with the statement that it "no longer results in the
parameters getting parsed" since this was never implemented.

Rémy
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.