Browse Source

another small fix related to DownloadState

main v0.2.3r1
Georg Hopp 11 months ago
parent
commit
063c10a03f
Signed by: ghopp GPG Key ID: 4C5D226768784538
  1. 4
      src/client.rs

4
src/client.rs

@ -39,7 +39,6 @@ type HttpClient = BoxCloneService<Request<Body>, ClientResponse, anyhow::Error>;
#[derive(Clone, Debug)]
pub(super) enum DownloadState {
None,
GotHead,
#[allow(dead_code)]
Partial { content_type: Option<String>, size: usize },
#[allow(dead_code)]
@ -144,11 +143,10 @@ impl Client {
let content_type = util::get_header::<String>( response_headers
, CONTENT_TYPE )
. or(Some("unknown".into()));
let state = DownloadState::GotHead;
if let Some(content_length) = content_length {
if from != 0 && content_length - 1 <= from {
return Ok(state);
return Ok(DownloadState::Done { content_type, size: from as usize });
}
} else {
from = 0;

Loading…
Cancel
Save