Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Flow HttpClient timeouts and cancellation to the response stream #9102

Merged

Conversation

stephentoub
Copy link
Member

(This is the same PR as #9041, which was already signed-off on; Jenkins wasn't responding to requests on it.)

When using a timeout and/or a cancellation token with a buffered HttpClient operation, the cancellation/timeout doesn't flow through to the actual read/write operations on the underlying streams. This means that on Windows, doing a basic operation like GetStringAsync with a server that pauses for arbitrarily long periods of time while sending the response body won't cancel or timeout until it sends more data. (We don't need to do this on Unix, as on Unix we already handle this case differently, with a single registration for the duration of the SendAsync operation.)

When using a timeout and/or a cancellation token with a buffered HttpClient operation, the cancellation/timeout doesn't flow through to the actual read/write operations on the underlying streams.  This means that on Windows, doing a basic operation like GetStringAsync with a server that pauses for arbitrarily long periods of time while sending the response body won't cancel or timeout until it sends more data. (We don't need to do this on Unix, as on Unix we already handle this case differently, with a single registration for the duration of the SendAsync operation.)
@davidsh
Copy link
Contributor

davidsh commented Jun 3, 2016

Ref: Issue #8663

@stephentoub stephentoub merged commit 3eb2e11 into dotnet:master Jun 3, 2016
@stephentoub stephentoub deleted the slowread_windows_cancellation branch June 3, 2016 17:10
@karelz karelz modified the milestone: 1.1.0 Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…ws_cancellation

Flow HttpClient timeouts and cancellation to the response stream

Commit migrated from dotnet/corefx@3eb2e11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants