arturobernalg opened a new pull request, #1267: URL: https://github.com/apache/tomcat/pull/1267
When an HTTP/2 request has trailer fields, `Stream.receivedEndOfHeaders()` runs again at the end of the trailer section and adds the merged `cookie` header a second time, so the application sees two `cookie` headers. An allowed `cookie` trailer field (`allowedTrailerHeaders="cookie"`) is appended to the merged request cookie instead of being exposed as a trailer field, which RFC 9110, section 6.5.1 does not allow. Allowed `host`, `priority` and `expect` trailer fields also go through the request header handling. All of this happens on the connection thread after the request has been passed to a container thread. Allowed trailer fields are now added directly to the trailer fields, and the end of headers processing is skipped for the trailer section. Testing: - New `TestStream.testCookieHeaderWithTrailers` and `testCookieTrailerAllowed`. On main the cookie headers are `[a=1; b=2, a=1; b=2]`, and `[a=1; b=2, a=1; b=2; c=3]` with no `cookie` trailer field. With the fix they are `[a=1; b=2]`, and the `cookie` trailer field is `c=3`. - Local Tomcat built from main, h2c, POST with cookies and trailers: the same results as the tests, before and after the fix. - All `org.apache.coyote.http2` tests pass. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
