mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 08:43:08 -07: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:
parent
ea1c4a8fc8
commit
61d2ff359b
11 changed files with 53 additions and 32 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue