-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Concerns only HTTP/1.1, both sync and async scenarios and only if the server does not reply with 100 Continue status line.
The client sends headers with Expect: 100-continue and starts a expect100Timer. Because the server doesn't send 100 Continue, the timer expires and starts sending the request content. If the content is faulty (e.g. throwing NSE in sync scenario due to missing sync override), no request body is sent and the server might never reply. As a result, HttpConnection keeps waiting for the status line indefinitely. If there's a request timeout and the connection gets torn down, the original exception from the faulty HttpContent gets lost. This might cause serious issues while trying to troubleshoot this problem.
Note that this is rather corner case scenario: faulty custom HttpContent + Expect: 100-continue + server not replying at all without a request body.
Possible fixes:
- Similar to HTTP/2 behavior, i.e.: using
WaitAny. Although this might prove challenging in the sync scenario where the status line parsing is synchronous. It would have to be reverted back to async for theExpect: 100case. - Similar to cancellation, i.e.: tearing down the connection if the expect100Timer expired and
HttpContentsending failed. However the exception from thesendRequestContentTaskshould be picked up in the final exception handling.