Port QNetworkProxy over to use QRegularExpression

The windows and macOS implementations where still using QRegExp
in one place.

Change-Id: Iaf6c6ead10f7f061ff0edce889abe18751b9d308
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
This commit is contained in:
Lars Knoll 2020-04-09 10:18:48 +02:00
parent 30f69f7ff6
commit e80544ebca
2 changed files with 8 additions and 6 deletions

View File

@ -45,7 +45,7 @@
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <SystemConfiguration/SystemConfiguration.h> #include <SystemConfiguration/SystemConfiguration.h>
#include <QtCore/QRegExp> #include <QtCore/QRegularExpression>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QUrl> #include <QtCore/QUrl>
#include <QtCore/qendian.h> #include <QtCore/qendian.h>
@ -110,8 +110,9 @@ static bool isHostExcluded(CFDictionaryRef dict, const QString &host)
return true; // excluded return true; // excluded
} else { } else {
// do wildcard matching // do wildcard matching
QRegExp rx(entry, Qt::CaseInsensitive, QRegExp::Wildcard); QRegularExpression rx(QRegularExpression::wildcardToRegularExpression(entry),
if (rx.exactMatch(host)) QRegularExpression::CaseInsensitiveOption);
if (rx.match(host).hasMatch())
return true; return true;
} }
} }

View File

@ -43,7 +43,7 @@
#include <qmutex.h> #include <qmutex.h>
#include <qstringlist.h> #include <qstringlist.h>
#include <qregexp.h> #include <qregularexpression.h>
#include <qurl.h> #include <qurl.h>
#include <private/qsystemlibrary_p.h> #include <private/qsystemlibrary_p.h>
#include <qnetworkinterface.h> #include <qnetworkinterface.h>
@ -212,8 +212,9 @@ static bool isBypassed(const QString &host, const QStringList &bypassList)
return true; // excluded return true; // excluded
} else { } else {
// do wildcard matching // do wildcard matching
QRegExp rx(entry, Qt::CaseInsensitive, QRegExp::Wildcard); QRegularExpression rx(QRegularExpression::wildcardToRegularExpression(entry),
if (rx.exactMatch(host)) QRegularExpression::CaseInsensitiveOption);
if (rx.match(host).hasMatch())
return true; return true;
} }
} }