Skip to content

Commit

Permalink
Propagate unsupported error when server returns 200 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh authored Feb 17, 2024
1 parent 139c655 commit a14e65d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit a14e65d

Please sign in to comment.