Skip to content

HTTP Cancellation tests should validate cancellation on the wire #58238

Open

Description

@geoffkizer

We have a bunch of cancellation tests in HttpClientHandlerTest.Cancellation.cs that validate that requests can be cancelled on the client. But none of these are actually validating that the server is properly notified of the cancellation, via the HTTP version specific mechanism (like RST_STREAM for HTTP2).

The loopback server WaitForCancellationAsync method was added to do exactly this -- validate that the server sees the client's cancellation. But currently none of these tests use it. We should modify these tests to use it, which should both (a) simplify some of the test logic (hopefully) and (b) validate that we are cancelling properly on the wire in all cases.

(The only case in which we use WaitForCancellationAsync is in a request finalization test, which sort of makes sense since the only way to actually verify finalization is to observe the behavior on the wire.)

Note that WinHttpHandler seems to aggressively send RST on request cancellation for HTTP/1.1, so we will need to modify the HTTP/1.1 implementation of WaitForCancellationAsync to allow RST.

Related issues:
#58234
#58235

Activity

  1. ghost added
    untriaged
    on Aug 27, 2021
  2. added this to the 7.0.0 milestone on Sep 2, 2021
  3. removed
    untriaged
    on Sep 2, 2021
  4. modified the milestones: 7.0.0, Future on Jul 21, 2022
  5. karelz commented on Jul 21, 2022

    @karelz
    Member

    Triage: Test enhancement, not critical for 7.0 -- moving to Future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.Httptest-enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions