arturobernalg opened a new pull request, #1262:
URL: https://github.com/apache/tomcat/pull/1262

   RFC 9112, section 5.2 requires a server that receives an obs-fold to either 
reject the message or "replace each received obs-fold with one or more SP 
octets prior to interpreting the field value". RFC 9110, section 5.5: "A field 
value does not include leading or trailing whitespace. When a specific version 
of HTTP allows such whitespace to appear in a message, a field parsing 
implementation MUST exclude such whitespace prior to evaluating the field 
value."
   
   `HttpHeaderParser` inserts the SP that replaces an obs-fold even when the 
fold comes before any field value, so `X-A:` CRLF ` one` is parsed as ` one`. 
The SP is now only inserted when the field value already has content before the 
fold.
   
   Tested on a local Tomcat (header value echoed by a JSP), compared with httpd 
2.4.69 (mod_proxy, value forwarded to the backend) and Netty 4.1.130 
(`HttpRequestDecoder`):
   
   | request header | before | after | httpd | Netty |
   |---|---|---|---|---|
   | `X-A:` CRLF ` one` | ` one` | `one` | `one` | rejected |
   | `X-A: one` CRLF ` two` | `one two` | `one two` | `one two` | `one two` |
   
   The new tests in TestHttp11InputBuffer fail without the change.


-- 
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]

Reply via email to