Treat HTTP/2 stream errors as spurious network errors.

This commit is contained in:
Alex Helfet 2019-04-18 11:33:15 +01:00
parent ef0223f125
commit cc29c2b609
2 changed files with 10 additions and 2 deletions

View file

@ -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"

View file

@ -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;
}
@ -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()));
}