aboutsummaryrefslogtreecommitdiff
path: root/src/webengine/urlinterceptor.cpp
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2017-08-05 15:05:22 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2017-08-05 15:05:22 +0200
commit9089047b0f5fac8a394ef0b4c8822ce5c7483212 (patch)
tree9b5307ee66c08492ae4d79d150e6b4ac71fb677d /src/webengine/urlinterceptor.cpp
parentMerge branch 'master' of ssh://bitbucket.org/xiannox/smolbote (diff)
downloadsmolbote-9089047b0f5fac8a394ef0b4c8822ce5c7483212.tar.xz
Changed the filter format
Diffstat (limited to 'src/webengine/urlinterceptor.cpp')
-rw-r--r--src/webengine/urlinterceptor.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/webengine/urlinterceptor.cpp b/src/webengine/urlinterceptor.cpp
index 3ffcb44..19bc64f 100644
--- a/src/webengine/urlinterceptor.cpp
+++ b/src/webengine/urlinterceptor.cpp
@@ -21,10 +21,6 @@
#include "urlinterceptor.h"
#include "filter/filtercollection.h"
-#ifdef DEBUG_VERBOSE
-#include <QTime>
-#endif
-
UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) :
QWebEngineUrlRequestInterceptor(parent)
{
@@ -33,25 +29,18 @@ UrlRequestInterceptor::UrlRequestInterceptor(QObject *parent) :
void UrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)
{
#ifdef DEBUG_VERBOSE
- QTime time;
- qDebug("%s --> [%i] %s", qUtf8Printable(info.firstPartyUrl().toString()), info.resourceType(), qUtf8Printable(info.requestUrl().toString()));
- time.start();
+ qDebug("%s -[%i]-> %s", qUtf8Printable(info.firstPartyUrl().toString()), info.resourceType(), qUtf8Printable(info.requestUrl().toString()));
#endif
-
for(auto s : m_manager->subscriptions()) {
- FilterCollection::MatchResult r = s->match(info);
- if(r.match) {
- info.block(r.block);
+ bool shouldBlock = s->match(info);
+ if(shouldBlock) {
+ info.block(true);
#ifdef DEBUG_VERBOSE
- qDebug(">> matched [%s] [%s] in %i ms", r.block ? "blocked" : "allowed", qUtf8Printable(r.pattern), time.elapsed());
+ qDebug(">> blocked");
#endif
return;
}
}
-
-#ifdef DEBUG_VERBOSE
- qDebug(">> passed in %i ms", time.elapsed());
-#endif
}
void UrlRequestInterceptor::setSubscription(BlockerManager *manager)