[core] finish must-revalidate support

This commit is contained in:
Konstantin Käfer
2017-08-01 18:00:48 +02:00
parent 68f470fdda
commit f0a7c45064
22 changed files with 320 additions and 146 deletions

View File

@@ -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;
}
}
}