File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333//! # Cancel safety
3434//!
3535//! Futures returned by hyper are cancel safe: dropping a future before it
36- //! completes is the supported way to cancel the operation. See the
37- //! documentation on individual futures — for example `SendRequest::send_request`
38- //! in `client::conn::http1` and `client::conn::http2` — for the protocol-
39- //! specific behavior on cancellation.
36+ //! completes is the supported way to cancel the operation. The protocol in
37+ //! use changes what that cancellation actually does on the wire:
38+ //!
39+ //! - **HTTP/1** has no in-protocol way to abort a single request without
40+ //! affecting the shared connection, so dropping an in-flight request future
41+ //! closes the underlying TCP connection. Any subsequent call on the same
42+ //! `SendRequest` returns a `canceled` error; the connection cannot be
43+ //! reused.
44+ //! - **HTTP/2** resets the single stream with `RST_STREAM` (`CANCEL` error
45+ //! code) and notifies the peer immediately rather than continuing to
46+ //! deliver a response body that would be discarded. The shared connection
47+ //! stays usable for other in-flight and future requests.
48+ //!
49+ //! See the documentation on individual futures — for example
50+ //! `SendRequest::send_request` in `client::conn::http1` and the equivalent
51+ //! in `client::conn::http2` — for the protocol-specific behavior on
52+ //! cancellation.
4053//!
4154//! # Optional Features
4255//!
You can’t perform that action at this time.
0 commit comments