Skip to content

HTTP2: Expect: 100-Continue support and early response handling #26930

Closed
dotnet/corefx
#36884

Description

@geoffkizer

We need to add logic to the HTTP implementation to support Expect: 100-continue.

In particular:
(1) If the user sets this header, defer sending the request body until we receive a either a 100 continue, or the 100-continue timeout expires
(2) If instead we receive a final response, and the status code is >=300, we should reset the request stream and stop sending it (if we started due to the timeout expiring)

We should also consider doing (2) above even without Expect: 100-continue. We don't do this for HTTP/1.1 currently, but it's not clear to me why we don't.

Activity

  1. geoffkizer commented on Jul 24, 2018

    @geoffkizer
    ContributorAuthor

    For reference see the logic related to "hasExpectContinueHeader" in HttpConnection.SendAsyncCore.

  2. gmazzotti commented on Dec 11, 2018

    @gmazzotti
  3. self-assigned this
    on Feb 8, 2019
  4. karelz commented on Feb 8, 2019

    @karelz
    Member

    @gmazzotti your post seems to be unrelated to this issue. This is about HTTP/2 support of 100-Continue. HTTP/2 is now being added, it is not something that exists.
    I will hide your post as off-topic. Please feel free to file a new issue with description of a problem you have - simple repro and clear description what is wrong, or what you want to add would be great. Thanks!

  5. karelz commented on Feb 27, 2019

    @karelz
    Member

    @wfurt are you actively working on it? (it is assigned to you)

  6. removed their assignment
    on Feb 27, 2019
  7. Tratcher commented on Jun 14, 2019

    @Tratcher
    Member

    (2) If instead we receive a final response, and the status code is >=300, we should reset the request stream and stop sending it (if we started due to the timeout expiring)

    We should also consider doing (2) above even without Expect: 100-continue. We don't do this for HTTP/1.1 currently, but it's not clear to me why we don't.

    Because for HTTP/1.1 that would close the socket and could lead to exhaustion. There's also a trade off for how long it takes to drain the request body vs how long it would take to establish a new socket connection (especially over TLS, proxies, etc). Using a request body drain timeout similar to the one for the response body might be a good compromise.

  8. Tratcher commented on Jun 14, 2019

    @Tratcher
    Member

    Note HttpWebRequest on 4.x has a mitigation for HTTP/1.1 chunked requests where it will send the chunked terminator instead of sending the request body for early 300+ response statuses. It also takes into account if the request body is buffered/re-transmittable, if not it will close the connection so that it can send the body only on the new request instead (e.g. auth, redirects, etc.).

  9. wfurt commented on Jun 14, 2019

    @wfurt
    Member

    I was talking about some of the behavior with @mconnew in context of #26662. However, the current layering makes it somewhat challenging .

  10. Tratcher commented on Jun 14, 2019

    @Tratcher
    Member

    Ah, yeah, WCF was the customer for the HttpWebRequest change as well.

  11. transferred this issue fromdotnet/corefxon Jan 31, 2020
  12. added this to the 3.0 milestone on Jan 31, 2020
  13. ghost locked as resolved and limited conversation to collaborators on Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions