Skip to content

Commit 91ca378

Browse files
committed
fix(download): work around hyper hang issue by adjusting reqwest config
1 parent d1cc5ca commit 91ca378

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

download/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,10 @@ pub mod reqwest_be {
345345

346346
fn client_generic() -> ClientBuilder {
347347
Client::builder()
348+
// HACK: set `pool_max_idle_per_host` to `0` to avoid an issue in the underlying
349+
// `hyper` library that causes the `reqwest` client to hang in some cases.
350+
// See <https://github.com/hyperium/hyper/issues/2312> for more details.
351+
.pool_max_idle_per_host(0)
348352
.gzip(false)
349353
.proxy(Proxy::custom(env_proxy))
350354
.timeout(Duration::from_secs(30))

download/tests/read-proxy-env.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ async fn socks_proxy_request() {
6161
let url = Url::parse("http://192.168.0.1/").unwrap();
6262

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

0 commit comments

Comments
 (0)