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

   RFC 9112, section 7.1.1 defines
   
   ```
   chunk-ext = *( BWS ";" BWS chunk-ext-name [ BWS "=" BWS chunk-ext-val ] )
   ```
   
   and RFC 9110, section 5.6.3 states "A recipient MUST parse for such bad 
whitespace and remove it before interpreting the protocol element".
   
   `ChunkExtension` already accepts BWS after the first semicolon (and 
`TestChunkExtension` models optional whitespace before it), but 
`ChunkedInputFilter` handled the bytes between the chunk size and the first 
semicolon itself and treated whitespace as an invalid hex digit, so `3 ;a=b` 
was rejected.
   
   Whitespace is now accepted after the chunk size only when it is followed by 
a chunk extension. A chunk size followed by whitespace and CRLF (not allowed by 
the grammar), whitespace before the chunk size and whitespace within the chunk 
size are still rejected.
   
   Tested on a local Tomcat (chunked POST read by a servlet), compared with 
httpd 2.4.69 (mod_dav PUT) and Netty 4.1.130 (`HttpRequestDecoder`):
   
   | chunk header | before | after | httpd | Netty |
   |---|---|---|---|---|
   | `3 ; ext=val` | rejected | accepted | accepted | accepted |
   | `3\t;ext` | rejected | accepted | accepted | accepted |
   | `3 ` + CRLF | rejected | rejected | accepted | accepted |
   | ` 3;ext` | rejected | rejected | 400 | accepted |
   
   The new tests in TestChunkedInputFilter 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