[frameworks/kdav] src/common: network: Setup more strict network policy

Kevin Ottens <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit f14cce8ff51dd39be4d4ef8aea67621e8080963e by Kevin Ottens, on behalf of Carl Schwan.
Committed on 28/07/2026 at 19:47.
Pushed by ervin into branch 'master'.

network: Setup more strict network policy

M  +5    -0    src/common/davmanager.cpp

https://invent.kde.org/frameworks/kdav/-/commit/f14cce8ff51dd39be4d4ef8aea67621e8080963e

diff --git a/src/common/davmanager.cpp b/src/common/davmanager.cpp
index 6b0e1c6..822403a 100644
--- a/src/common/davmanager.cpp
+++ b/src/common/davmanager.cpp
@@ -16,6 +16,7 @@
 #include <QNetworkAccessManager>
 #include <QNetworkReply>
 #include <QNetworkRequest>
+#include <QStandardPaths>
 #include <QUrl>
 #include <qnetworkreply.h>
 
@@ -25,6 +26,10 @@ using namespace Qt::StringLiterals;
 DavManager::DavManager()
     : mNam(std::make_unique<QNetworkAccessManager>())
 {
+    mNam->setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);
+    mNam->enableStrictTransportSecurityStore(true, QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + u"/hsts/"_s);
+    mNam->setStrictTransportSecurityEnabled(true);
+
     QObject::connect(mNam.get(), &QNetworkAccessManager::authenticationRequired, [](QNetworkReply *reply, QAuthenticator *auth) {
         const QUrl url = reply->request().url();
         if (!url.userName().isEmpty()) {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.