+ bool success = reply.isSuccessful();
+ if (!success) {
+ // Fallback to stale cached data on HTTP error
+ const QByteArray value = cache->possiblyStaleValue(key);
+ if (!value.isNull()) {
+ qDebug() << "Using stale cache value" << reply.url();
+ emit data(value);
+ auto replyFromCache = new CachedHttpReply(value, reply.url(), false);
+ emit finished(*replyFromCache);
+ replyFromCache->deleteLater();
+ return;
+ }
+ }