#hyper-client #timeout #read-write #connector #aware #connect

hyper-timeout

A connect, read and write timeout aware connector to be used with hyper Client

10 releases

0.5.1 Jan 14, 2024
0.5.0 Dec 3, 2023
0.4.1 Jan 2, 2021
0.4.0 Dec 24, 2020
0.1.1 Jul 24, 2017

#28 in Web programming

Download history 480482/week @ 2023-12-06 475782/week @ 2023-12-13 310487/week @ 2023-12-20 229174/week @ 2023-12-27 468113/week @ 2024-01-03 477253/week @ 2024-01-10 542735/week @ 2024-01-17 514683/week @ 2024-01-24 531998/week @ 2024-01-31 537518/week @ 2024-02-07 515861/week @ 2024-02-14 560381/week @ 2024-02-21 575089/week @ 2024-02-28 558749/week @ 2024-03-06 560173/week @ 2024-03-13 460215/week @ 2024-03-20

2,266,166 downloads per month
Used in 274 crates (22 directly)

MIT/Apache

31KB
719 lines

crates.io

hyper-timeout

A connect, read and write timeout aware connector to be used with hyper Client.

Problem

At the time this crate was created, hyper does not support timeouts. There is a way to do general timeouts, but no easy way to get connect, read and write specific timeouts.

Solution

There is a TimeoutConnector that implements the hyper::Connect trait. This connector wraps around HttpConnector or HttpsConnector values and provides timeouts.

Note: In hyper 0.11, a read or write timeout will return a broken pipe error because of the way tokio_proto::ClientProto works

Usage

Hyper version compatibility:

  • The master branch will track on going development for hyper.
  • The 0.5 release supports hyper 1.0.
  • The 0.4 release supports hyper 0.14.
  • The 0.3 release supports hyper 0.13.
  • The 0.2 release supports hyper 0.12.
  • The 0.1 release supports hyper 0.11.

Assuming you are using hyper 1.0, add this to your Cargo.toml:

[dependencies]
hyper-timeout = "0.5"

See the client example for a working example.

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~5.5MB
~90K SLoC