arturobernalg opened a new pull request, #1211: URL: https://github.com/apache/tomcat/pull/1211
RFC 9110, section 8.6 defines the value of a content-length field as one or more digits, and RFC 9113, section 8.1.1 requires a request that is malformed to be treated as a stream error of type PROTOCOL_ERROR. In HTTP/2 the value was parsed with `Long.parseLong()`, so a request with `content-length: +3`, `-0` or `-1` was accepted, and a negative value was treated as if the field was absent. HTTP/1.1 rejects the same values with a 400 response. This checks the value in `Stream.emitHeader()` and resets the stream with PROTOCOL_ERROR if it is not made of digits. Tested with a running Tomcat and a raw HTTP/2 client: without the change those requests are processed, with the change the stream is reset with PROTOCOL_ERROR. Valid values, including ones with leading zeros, are not affected. -- 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]
