Skip to content

Commit

Permalink
do a propper range request
Browse files Browse the repository at this point in the history
  • Loading branch information
djugei committed Oct 12, 2024
1 parent 07de06f commit 5705fdd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ pub(crate) async fn do_download<W: AsyncRead + AsyncWrite + AsyncSeek, G: AsRef<
let mut delta = {
loop {
// catch both client and server timeouts and simply retry
match client.get(&url).header(http::header::RANGE, writepos).send().await {
let range = format!("bytes={writepos}-");
match client.get(&url).header(http::header::RANGE, range).send().await {
Ok(d) => match d.status() {
StatusCode::REQUEST_TIMEOUT | StatusCode::GATEWAY_TIMEOUT => {
debug!("timeout; retrying {}", url)
Expand Down

0 comments on commit 5705fdd

Please sign in to comment.