diff options
author | Julian Andres Klode <jak@debian.org> | 2016-08-18 10:02:35 +0200 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-08-18 10:02:35 +0200 |
commit | d1fd09b982f6108dc32ec75330b0535236c48311 (patch) | |
tree | c0dce6cf7501c1e0d5e3bad34e9b63c0d6dcd354 /methods/https.cc | |
parent | b5fcba3682581b2a48921cc830dbf3deae6b0ff3 (diff) | |
parent | 43670e2ef8b689d9efba633d11d2a5fc6f9968a0 (diff) |
Merge tag '1.3_rc2' into ubuntu
apt Debian release 1.3~rc2
Diffstat (limited to 'methods/https.cc')
-rw-r--r-- | methods/https.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/methods/https.cc b/methods/https.cc index 283126f6b..b2d05136c 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -382,8 +382,15 @@ bool HttpsMethod::Fetch(FetchItem *Itm) headers = curl_slist_append(headers, "Accept: text/*"); } + // go for it - if the file exists, append on it + File = new FileFd(Itm->DestFile, FileFd::WriteAny); + if (Server == nullptr || Server->Comp(Itm->Uri) == false) + Server = CreateServerState(Itm->Uri); + else + Server->Reset(false); + // if we have the file send an if-range query with a range header - if (stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0) + if (Server->RangesAllowed && stat(Itm->DestFile.c_str(),&SBuf) >= 0 && SBuf.st_size > 0) { std::string Buf; strprintf(Buf, "Range: bytes=%lli-", (long long) SBuf.st_size); @@ -397,9 +404,6 @@ bool HttpsMethod::Fetch(FetchItem *Itm) curl_easy_setopt(curl, CURLOPT_TIMEVALUE, Itm->LastModified); } - // go for it - if the file exists, append on it - File = new FileFd(Itm->DestFile, FileFd::WriteAny); - Server = CreateServerState(Itm->Uri); if (Server->InitHashes(Itm->ExpectedHashes) == false) return false; |