From a14e65d1b9fdcac09f9bf77ec095ccd0618b89f2 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 17 Feb 2024 01:53:04 -0500 Subject: [PATCH] Propagate unsupported error when server returns 200 (#5) --- src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a1699e3..2919d92 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -475,6 +475,14 @@ async fn run_streamer( Ok(response) => response, }; + // If the server returns a successful, but non-206 response (e.g., 200), then it + // doesn't support range requests (even if the `Accept-Ranges` header is set). + if response.status() != reqwest::StatusCode::PARTIAL_CONTENT { + state.error = Some(AsyncHttpRangeReaderError::HttpRangeRequestUnsupported); + let _ = state_tx.send(state); + break 'outer; + } + if !stream_response( response, *range.start(),