diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 20 | ||||
-rw-r--r-- | src/network/kernel/qauthenticator_p.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index 4daf11cb3e..f79a7196bf 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -423,6 +423,26 @@ void QAuthenticatorPrivate::updateCredentials() } } +bool QAuthenticatorPrivate::isMethodSupported(QByteArrayView method) +{ + Q_ASSERT(!method.startsWith(' ')); // This should be trimmed during parsing + auto separator = method.indexOf(' '); + if (separator != -1) + method = method.first(separator); + const auto isSupported = [method](QByteArrayView reference) { + return method.compare(reference, Qt::CaseInsensitive) == 0; + }; + static const char methods[][10] = { + "basic", + "ntlm", + "digest", +#if QT_CONFIG(sspi) || QT_CONFIG(gssapi) + "negotiate", +#endif + }; + return std::any_of(methods, methods + std::size(methods), isSupported); +} + void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByteArray> > &values, bool isProxy, const QString &host) { #if !QT_CONFIG(gssapi) diff --git a/src/network/kernel/qauthenticator_p.h b/src/network/kernel/qauthenticator_p.h index 1813634ee0..9ef6330ceb 100644 --- a/src/network/kernel/qauthenticator_p.h +++ b/src/network/kernel/qauthenticator_p.h @@ -115,6 +115,8 @@ public: void parseHttpResponse(const QList<QPair<QByteArray, QByteArray> >&, bool isProxy, const QString &host); void updateCredentials(); + + static bool isMethodSupported(QByteArrayView method); }; |