Skip to content

Commit

Permalink
Treat HTTP/2 stream errors as spurious network errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Helfet committed Apr 18, 2019
1 parent ef0223f commit cc29c2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ bytesize = "1.0"
crates-io = { path = "src/crates-io", version = "0.24" }
crossbeam-utils = "0.6"
crypto-hash = "0.3.1"
curl = { version = "0.4.19", features = ['http2'] }
curl-sys = "0.4.15"
curl = { version = "0.4.21", features = ['http2'] }
curl-sys = "0.4.18"
env_logger = "0.6.0"
pretty_env_logger = { version = "0.3", optional = true }
failure = "0.1.5"
Expand Down
8 changes: 8 additions & 0 deletions src/cargo/util/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ fn maybe_spurious(err: &Error) -> bool {
|| curl_err.is_couldnt_resolve_host()
|| curl_err.is_operation_timedout()
|| curl_err.is_recv_error()
|| curl_err.is_http2_stream_error()
{
return true;
}
Expand Down Expand Up @@ -125,3 +126,10 @@ fn with_retry_finds_nested_spurious_errors() {
let result = with_retry(&config, || results.pop().unwrap());
assert_eq!(result.unwrap(), ())
}

#[test]
fn curle_http2_stream_is_spurious() {
let code = curl_sys::CURLE_HTTP2_STREAM;
let err = curl::Error::new(code);
assert!(maybe_spurious(&err.into()));
}

0 comments on commit cc29c2b

Please sign in to comment.