diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-08-01 18:00:48 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-08-08 12:40:38 +0200 |
commit | f0a7c45064c3ce3f509b1c2035fcaa07ccc35a99 (patch) | |
tree | 5813cfe2fd8e72cbf06f45990351b7412146c398 /platform/default/default_file_source.cpp | |
parent | 68f470fdda4e31d7704fba3e41bb2f899db39541 (diff) | |
download | qtlocation-mapboxgl-f0a7c45064c3ce3f509b1c2035fcaa07ccc35a99.tar.gz |
[core] finish must-revalidate support
Diffstat (limited to 'platform/default/default_file_source.cpp')
-rw-r--r-- | platform/default/default_file_source.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/platform/default/default_file_source.cpp b/platform/default/default_file_source.cpp index bf8d7b6348..9c8a38a308 100644 --- a/platform/default/default_file_source.cpp +++ b/platform/default/default_file_source.cpp @@ -140,7 +140,17 @@ public: revalidation.priorModified = offlineResponse->modified; revalidation.priorExpires = offlineResponse->expires; revalidation.priorEtag = offlineResponse->etag; - callback(*offlineResponse); + + // Don't return resources the server requested not to show when they're stale. + // Even if we can't directly use the response, we may still use it to send a + // conditional HTTP request. + if (offlineResponse->isUsable()) { + callback(*offlineResponse); + } else { + // Since we can't return the data immediately, we'll have to hold on so that + // we can return it later in case we get a 304 Not Modified response. + revalidation.priorData = offlineResponse->data; + } } } |