Fallback to streaming after BufError

This commit is contained in:
Charlie Marsh 2024-02-28 15:33:58 -05:00
parent 9328b3c2ab
commit c24f13529c
1 changed files with 11 additions and 2 deletions

View File

@ -187,10 +187,10 @@ impl ErrorKind {
}
}
// The server doesn't support range requests, but we only discovered this while
// unzipping due to erroneous server behavior.
Self::Zip(_, ZipError::UpstreamReadError(err)) => {
if let Some(inner) = err.get_ref() {
// The server doesn't support range requests, but we only discovered this while
// unzipping due to erroneous server behavior.
if let Some(inner) = inner.downcast_ref::<AsyncHttpRangeReaderError>() {
if matches!(
inner,
@ -199,6 +199,15 @@ impl ErrorKind {
return true;
}
}
// There was an I/O error (typically, a `BufError`) while reading from the
// server, which could be due to the server not supporting range requests.
if inner
.downcast_ref::<std::io::Error>()
.is_some_and(|error| error.kind() == std::io::ErrorKind::Other)
{
return true;
}
}
}