On 05/06/2026 19:41, Chuck Caldarale wrote:
On Jun 5, 2026, at 13:28:04, [email protected] wrote:
This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 906a431240ba2fd797565384460fd7433a81af83
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Jun 5 19:16:09 2026 +0100
Don't unintentionally create a limit on number of trailer headers
---
java/org/apache/coyote/Request.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/java/org/apache/coyote/Request.java
b/java/org/apache/coyote/Request.java
index f9b8fbdec9..8e10da626c 100644
--- a/java/org/apache/coyote/Request.java
+++ b/java/org/apache/coyote/Request.java
@@ -1149,6 +1149,7 @@ public final class Request {
* instance.
*/
trailerFields.setLimit(MimeHeaders.DEFAULT_HEADER_SIZE);
+ trailerFields.setLimit(-1);
Should the first trailerFields.setLimit() call be removed? Or is there
something very subtle going on?
There is something subtle going on.
The comment above (which you can't see in the diff) adds some background.
The case we want to handle is when the request being recycled has lots
of headers. We want to reduce the MIME headers object back to the
default 8 to keep the ongoing memory overhead in check.
If, when setting the limit to a number > 0 the array is larger than that
limit, the array is reduced in size to that limit.
So what we are doing is:
- making sure the array is no bigger than 8 headers
- allowing to grow beyond that for the next request if it needs to
And for those worrying about allowing unlimited headers, there is a
limit in place on total header size.
HTH,
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]