Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.3:Update
plasma5-desktop.17405
0004-Only-trust-the-expiration-date-if-it-s-les...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0004-Only-trust-the-expiration-date-if-it-s-less-than-24-.patch of Package plasma5-desktop.17405
From 863ba2faa1849acd3b3fecfb111a96c171db2a29 Mon Sep 17 00:00:00 2001 From: Dan Leinir Turthra Jensen <admin@leinir.dk> Date: Wed, 9 Feb 2022 09:23:50 +0000 Subject: [PATCH 4/5] Only trust the expiration date if it's less than 24 hours (cherry picked from commit b85cf34298c274b5f16cb6c2aead7b87f0dabbb8) --- attica-kde/kdeplugin/kdeplatformdependent.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/attica-kde/kdeplugin/kdeplatformdependent.cpp b/attica-kde/kdeplugin/kdeplatformdependent.cpp index 9864756ca..7f71d4627 100644 --- a/attica-kde/kdeplugin/kdeplatformdependent.cpp +++ b/attica-kde/kdeplugin/kdeplatformdependent.cpp @@ -103,7 +103,16 @@ QNetworkRequest KdePlatformDependent::removeAuthFromRequest(const QNetworkReques } for (const QString &endpoint : preferCacheEndpoints) { if (notConstReq.url().endsWith(endpoint)) { - notConstReq.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); + QNetworkCacheMetaData cacheMeta{m_accessManager->cache.metaData(notConstReq.url())}; + if (cacheMeta.isValid()) { + // If the expiration date is valid, but longer than 24 hours, don't trust that things + // haven't changed and check first, otherwise just use the cached version to relieve + // server strain and reduce network traffic. + const QDateTime tomorrow{QDateTime::currentDateTime().addDays(1)}; + if (cacheMeta.expirationDate().isValid() && cacheMeta.expirationDate() < tomorrow) { + notConstReq.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); + } + } break; } } -- 2.33.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor