diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-13 16:47:36 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-01-14 13:46:03 -0800 |
commit | 2aafdbc1b84192d9a51ff7f5f9d9830e0951bb2a (patch) | |
tree | b43c6d0bbb86988628c611f21ba7d2cc15340c40 /platform/default/http_request_curl.cpp | |
parent | 2ee1fe41786742332d190b01e28ba88a72c59f43 (diff) | |
download | qtlocation-mapboxgl-2aafdbc1b84192d9a51ff7f5f9d9830e0951bb2a.tar.gz |
[core] Add an explicit "not modified" indicator to Response
Diffstat (limited to 'platform/default/http_request_curl.cpp')
-rw-r--r-- | platform/default/http_request_curl.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp index e1ea931fbe..7f95d187cb 100644 --- a/platform/default/http_request_curl.cpp +++ b/platform/default/http_request_curl.cpp @@ -529,18 +529,20 @@ void HTTPCURLRequest::handleResult(CURLcode code) { if (responseCode == 200) { // Nothing to do; this is what we want. } else if (responseCode == 304) { + response->notModified = true; + if (existingResponse) { - // We're going to copy over the existing response's data. - if (existingResponse->error) { - response->error = std::make_unique<Error>(*existingResponse->error); + if (response->expires == Seconds::zero()) { + response->expires = existingResponse->expires; + } + + if (response->modified == Seconds::zero()) { + response->modified = existingResponse->modified; + } + + if (response->etag.empty()) { + response->etag = existingResponse->etag; } - response->data = existingResponse->data; - response->modified = existingResponse->modified; - // We're not updating `expired`, it was probably set during the request. - response->etag = existingResponse->etag; - } else { - // This is an unsolicited 304 response and should only happen on malfunctioning - // HTTP servers. It likely doesn't include any data, but we don't have much options. } } else if (responseCode == 404) { response->error = |