From 0877f76aae9e3b66817fcc850112e4a308ffdd88 Mon Sep 17 00:00:00 2001 From: konsti Date: Mon, 29 Jul 2024 15:53:23 +0200 Subject: [PATCH] Retry on incomplete body (#5555) This is an attempt to add https://github.com/astral-sh/uv/issues/3514#issuecomment-2253562096 to retrying. Relevant hyper code: * https://github.com/hyperium/hyper/blob/15cd6fa1fc52f88b58283a673c134a97bea275d3/src/proto/h1/decode.rs#L683 * https://github.com/hyperium/hyper/blob/15cd6fa1fc52f88b58283a673c134a97bea275d3/src/proto/h1/decode.rs#L161-L164 --- crates/uv-client/src/base_client.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/uv-client/src/base_client.rs b/crates/uv-client/src/base_client.rs index a237e981d..bae9cef06 100644 --- a/crates/uv-client/src/base_client.rs +++ b/crates/uv-client/src/base_client.rs @@ -290,7 +290,9 @@ fn is_extended_transient_error(res: &Result // Check for connection reset errors, these are usually `Body` errors which are not retried by default. if let Err(reqwest_middleware::Error::Reqwest(err)) = res { if let Some(io) = find_source::(&err) { - if io.kind() == std::io::ErrorKind::ConnectionReset { + if io.kind() == std::io::ErrorKind::ConnectionReset + || io.kind() == std::io::ErrorKind::UnexpectedEof + { return true; } }