mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-18 06:28:03 -06:00
Use QRegularExpression instead of deprecated QRegExp
Now it follows closely the definition of wildcard for glob patterns. The backslash (\) character is not an escape char in this context. In order to match one of the special characters, place it in square brackets (for example, [?]).
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
#include <QMimeDatabase>
|
||||
#include <QMimeType>
|
||||
#include <QNetworkCookie>
|
||||
#include <QRegExp>
|
||||
#include <QRegularExpression>
|
||||
#include <QUrl>
|
||||
|
||||
#include "base/algorithm.h"
|
||||
@@ -693,7 +693,7 @@ bool WebApplication::validateHostHeader(const QStringList &domains) const
|
||||
// try matching host header with domain list
|
||||
for (const auto &domain : domains)
|
||||
{
|
||||
QRegExp domainRegex(domain, Qt::CaseInsensitive, QRegExp::Wildcard);
|
||||
const QRegularExpression domainRegex {Utils::String::wildcardToRegexPattern(domain), QRegularExpression::CaseInsensitiveOption};
|
||||
if (requestHost.contains(domainRegex))
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user