Skip to content

Commit

Permalink
fix(download): work around hyper hang issue by adjusting reqwest
Browse files Browse the repository at this point in the history
…config
  • Loading branch information
rami3l committed Jun 4, 2024
1 parent d1cc5ca commit 91ca378
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions download/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ pub mod reqwest_be {

fn client_generic() -> ClientBuilder {
Client::builder()
// HACK: set `pool_max_idle_per_host` to `0` to avoid an issue in the underlying
// `hyper` library that causes the `reqwest` client to hang in some cases.
// See <https://github.com/hyperium/hyper/issues/2312> for more details.
.pool_max_idle_per_host(0)
.gzip(false)
.proxy(Proxy::custom(env_proxy))
.timeout(Duration::from_secs(30))
Expand Down
4 changes: 4 additions & 0 deletions download/tests/read-proxy-env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ async fn socks_proxy_request() {
let url = Url::parse("http://192.168.0.1/").unwrap();

let client = Client::builder()
// HACK: set `pool_max_idle_per_host` to `0` to avoid an issue in the underlying
// `hyper` library that causes the `reqwest` client to hang in some cases.
// See <https://github.com/hyperium/hyper/issues/2312> for more details.
.pool_max_idle_per_host(0)
.proxy(Proxy::custom(env_proxy))
.timeout(Duration::from_secs(1))
.build()
Expand Down

0 comments on commit 91ca378

Please sign in to comment.