summaryrefslogtreecommitdiffstats
path: root/src/nam.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2020-10-27 13:23:01 +0100
committerSimon Rettberg2020-10-27 13:23:01 +0100
commit43965eb877ed24d94b8cfa09f948b7877bcffc24 (patch)
tree3796e1a3d59b5df91007df6ab11b84405e5ef705 /src/nam.cpp
parentFix triggering "go back" on blocked URL (diff)
downloadslxbrowser-43965eb877ed24d94b8cfa09f948b7877bcffc24.tar.gz
slxbrowser-43965eb877ed24d94b8cfa09f948b7877bcffc24.tar.xz
slxbrowser-43965eb877ed24d94b8cfa09f948b7877bcffc24.zip
Allow blacklist and whitelist at the same time.
Whitelist takes precedence.
Diffstat (limited to 'src/nam.cpp')
-rw-r--r--src/nam.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nam.cpp b/src/nam.cpp
index 2f3fdd1..798a8e6 100644
--- a/src/nam.cpp
+++ b/src/nam.cpp
@@ -33,7 +33,14 @@ QNetworkReply* SlxNetworkAccessManager::createRequest(QNetworkAccessManager::Ope
} else if (url.host().isEmpty()) {
ok = true;
} else {
- ok = (_list.match(url.toDisplayString(QUrl::NormalizePathSegments)).hasMatch() == _isWhitelist);
+ auto str = url.toDisplayString(QUrl::NormalizePathSegments);
+ if (_white.isValid() && _white.match(str).hasMatch()) {
+ ok = true;
+ } else if (_black.isValid() && _black.match(str).hasMatch()) {
+ ok = false;
+ } else {
+ ok = true;
+ }
}
if (!ok) {
return new SlxDisabledNetworkReply(this, req, op);