diff options
author | Otavio Salvador <otavio@debian.org> | 2007-08-10 18:05:05 -0300 |
---|---|---|
committer | Otavio Salvador <otavio@debian.org> | 2007-08-10 18:05:05 -0300 |
commit | 5820530d3d12e509229fd624b8bb166728e6a21a (patch) | |
tree | c8a85a4e4158846a0b23685e4b56aea4537f5690 /methods | |
parent | 0901de85e2c7ce64cc9ae0643f53a70da4eeb9fe (diff) |
* Reset curl options and timestamp between downloaded files. Thanks to
Ryan Murray <rmurray@debian.org> for the patch (closes: #437150)
Diffstat (limited to 'methods')
-rw-r--r-- | methods/https.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/methods/https.cc b/methods/https.cc index e6717e63a..3b2b0bb19 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -115,6 +115,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm) // - error checking/reporting // - more debug options? (CURLOPT_DEBUGFUNCTION?) + curl_easy_reset(curl); SetupProxy(); // callbacks @@ -125,6 +126,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm) curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, this); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); + curl_easy_setopt(curl, CURLOPT_FILETIME, true); // FIXME: https: offer various options of verification bool peer_verify = _config->FindB("Acquire::https::Verify-Peer", false); @@ -202,6 +204,9 @@ bool HttpsMethod::Fetch(FetchItem *Itm) CURLcode success = curl_easy_perform(curl); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &curl_responsecode); + long curl_servdate; + curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate); + // cleanup if(success != 0) { @@ -215,6 +220,14 @@ bool HttpsMethod::Fetch(FetchItem *Itm) if (Res.Size == 0) Res.Size = File->Size(); + // Timestamp + struct utimbuf UBuf; + if (curl_servdate != -1) { + UBuf.actime = curl_servdate; + UBuf.modtime = curl_servdate; + utime(File->Name().c_str(),&UBuf); + } + // check the downloaded result struct stat Buf; if (stat(File->Name().c_str(),&Buf) == 0) |