diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2013-05-08 17:45:17 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2013-05-08 17:45:17 +0200 |
commit | 1dea08eb2e1115b8da14cc3da02d53f8e069ba14 (patch) | |
tree | 9d662f7af19792e0239c3f2e08413c26cb771992 /methods | |
parent | 55971004215609a02ca19c59bd058da20729ba11 (diff) |
properly handle if-modfied-since with libcurl/https
(closes: #705648)
Diffstat (limited to 'methods')
-rw-r--r-- | methods/https.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/methods/https.cc b/methods/https.cc index c1a49ba60..d85415b2f 100644 --- a/methods/https.cc +++ b/methods/https.cc @@ -285,6 +285,11 @@ bool HttpsMethod::Fetch(FetchItem *Itm) long curl_servdate; curl_easy_getinfo(curl, CURLINFO_FILETIME, &curl_servdate); + // If the server returns 200 OK but the If-Modified-Since condition is not + // met, CURLINFO_CONDITION_UNMET will be set to 1 + long curl_condition_unmet = 0; + curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &curl_condition_unmet); + File->Close(); // cleanup @@ -312,7 +317,7 @@ bool HttpsMethod::Fetch(FetchItem *Itm) Res.Filename = File->Name(); Res.LastModified = Buf.st_mtime; Res.IMSHit = false; - if (curl_responsecode == 304) + if (curl_responsecode == 304 || curl_condition_unmet) { unlink(File->Name().c_str()); Res.IMSHit = true; |