mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Bring back support for sending DNT header to servers
This commit is contained in:
parent
39c920f3ce
commit
3ec6da6103
@ -237,4 +237,6 @@ void NetworkManager::loadSettings()
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
mApp->webProfile()->setHttpAcceptLanguage(AcceptLanguage::generateHeader(langs));
|
mApp->webProfile()->setHttpAcceptLanguage(AcceptLanguage::generateHeader(langs));
|
||||||
|
|
||||||
|
m_urlInterceptor->loadSettings();
|
||||||
}
|
}
|
||||||
|
@ -18,20 +18,29 @@
|
|||||||
|
|
||||||
#include "networkurlinterceptor.h"
|
#include "networkurlinterceptor.h"
|
||||||
#include "urlinterceptor.h"
|
#include "urlinterceptor.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
NetworkUrlInterceptor::NetworkUrlInterceptor(QObject *parent)
|
NetworkUrlInterceptor::NetworkUrlInterceptor(QObject *parent)
|
||||||
: QWebEngineUrlRequestInterceptor(parent)
|
: QWebEngineUrlRequestInterceptor(parent)
|
||||||
|
, m_sendDNT(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
|
bool NetworkUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
|
||||||
{
|
{
|
||||||
foreach (UrlInterceptor *interceptor, m_interceptors) {
|
bool result = false;
|
||||||
if (interceptor->interceptRequest(info))
|
|
||||||
return true;
|
if (m_sendDNT) {
|
||||||
|
result = true;
|
||||||
|
info.setExtraHeader(QByteArrayLiteral("DNT"), QByteArrayLiteral("1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
foreach (UrlInterceptor *interceptor, m_interceptors) {
|
||||||
|
if (interceptor->interceptRequest(info))
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkUrlInterceptor::installUrlInterceptor(UrlInterceptor *interceptor)
|
void NetworkUrlInterceptor::installUrlInterceptor(UrlInterceptor *interceptor)
|
||||||
@ -44,3 +53,11 @@ void NetworkUrlInterceptor::removeUrlInterceptor(UrlInterceptor *interceptor)
|
|||||||
{
|
{
|
||||||
m_interceptors.removeOne(interceptor);
|
m_interceptors.removeOne(interceptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkUrlInterceptor::loadSettings()
|
||||||
|
{
|
||||||
|
Settings settings;
|
||||||
|
settings.beginGroup("Web-Browser-Settings");
|
||||||
|
m_sendDNT = settings.value("DoNotTrack", false).toBool();
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
@ -35,8 +35,11 @@ public:
|
|||||||
void installUrlInterceptor(UrlInterceptor *interceptor);
|
void installUrlInterceptor(UrlInterceptor *interceptor);
|
||||||
void removeUrlInterceptor(UrlInterceptor *interceptor);
|
void removeUrlInterceptor(UrlInterceptor *interceptor);
|
||||||
|
|
||||||
|
void loadSettings();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<UrlInterceptor*> m_interceptors;
|
QList<UrlInterceptor*> m_interceptors;
|
||||||
|
bool m_sendDNT;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETWORKURLINTERCEPTOR_H
|
#endif // NETWORKURLINTERCEPTOR_H
|
||||||
|
Loading…
Reference in New Issue
Block a user