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

   This builds on #1263, which is its first commit. Only the second commit is 
new; I will rebase once #1263 is merged.
   
   RFC 9110, section 10.1.1 defines Expect as a list (`Expect = #expectation`). 
An origin server that receives a request whose header section "contains a 
100-continue expectation and an indication that request content will follow" 
MUST send either an immediate final response or an immediate 100 (Continue) 
response. Over HTTP/2, a request with `Expect: foo, 100-continue` got neither 
and the server waited for the request content.
   
   With curl, a 200 KB POST and an 8 second expect timeout:
   
   | Expect | main, HTTP/2 | main, HTTP/1.1 | httpd 2.4.69 mod_http2 | this PR, 
HTTP/2 |
   |---|---|---|---|---|
   | `100-continue, foo` | 200 after 8 s, no 100 | 417 at once | 417 at once | 
200 in a few ms |
   | `foo, 100-continue` | 200 after 8 s, no 100 | 417 at once | 417 at once | 
200 in a few ms |
   | `100-continue,100-continue` | 200 after 8 s, no 100 | 417 at once | 417 at 
once | 200 in a few ms |
   
   The value is now parsed with `TokenList.parseTokenList()`, the list parser 
already used for Connection and Transfer-Encoding, after a fast path for a 
single `100-continue`. Other expectations are ignored: the 417 response is only 
a MAY and HTTP/2 already ignored `Expect: foo`. HTTP/1.1 is not changed.
   
   testSendAckList and testSendAckListWithEmptyElements in TestHttp2Section_8_1 
fail without the change; testNoAckForOtherExpectation and 
testNoAckForContinueWithParameter check that no 100 (Continue) response is sent 
for `foo` or `100-continue=1`.
   
   Known limitation: TokenList does not handle quoted strings, so an 
expectation such as `foo="a, 100-continue, b"` also gets a 100 (Continue) 
response. That is harmless, as RFC 9110, section 15.2 says "A client MUST be 
able to parse one or more 1xx responses received prior to a final response, 
even if the client does not expect one."


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