diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-20 00:42:46 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-20 00:42:46 +0200 |
| commit | cf3b60ea29526417a35734a4ae4f5a7b0d5560d5 (patch) | |
| tree | 1ff3846f2b10ddce0e883adf41ba35f7139945af /src/cryptoidentity.cpp | |
| parent | bdfd6ba6874ca1a7bcfa4ed075e686bfd119dc7e (diff) | |
| download | kristall-cf3b60ea29526417a35734a4ae4f5a7b0d5560d5.tar.gz | |
Adds new feature: Auto-enable and host matching for client certificates
Diffstat (limited to 'src/cryptoidentity.cpp')
| -rw-r--r-- | src/cryptoidentity.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cryptoidentity.cpp b/src/cryptoidentity.cpp index 921a422..2d9db59 100644 --- a/src/cryptoidentity.cpp +++ b/src/cryptoidentity.cpp @@ -1,2 +1,31 @@ #include "cryptoidentity.hpp" +#include <QUrl> +#include <QRegExp> +#include <cassert> + +bool CryptoIdentity::isHostFiltered(const QUrl &url) const +{ + if(this->host_filter.isEmpty()) + return false; + + QString url_text = url.toString(QUrl::FullyEncoded); + + QRegExp pattern { this->host_filter, Qt::CaseInsensitive, QRegExp::Wildcard }; + + return not pattern.exactMatch(url_text); +} + +bool CryptoIdentity::isAutomaticallyEnabledOn(const QUrl &url) const +{ + if(this->host_filter.isEmpty()) + return false; + if(not this->auto_enable) + return false; + + QString url_text = url.toString(QUrl::FullyEncoded); + + QRegExp pattern { this->host_filter, Qt::CaseInsensitive, QRegExp::Wildcard }; + + return pattern.exactMatch(url_text); +} |
