diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-05-13 21:53:07 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-06-22 20:12:41 +0000 |
commit | cad7100fda1b27ba56c4d9efc6bceba62859dfbc (patch) | |
tree | 942ff836a94aab364ae8c408dcfa44d8808c8134 /src/network/kernel | |
parent | c699daeceb4448c4545a67ffdba27bcb3b994114 (diff) |
QByteArray: add compare() with case sensitivity options
Need to do the same for startsWith() and endsWith(). indexOf() is a lot
harder.
[ChangeLog][QtCore][QByteArray] Added compare(), which takes
Qt::CaseSensitivity as one of the parameters. This function is more
efficient than using toLower() or toUpper() and then comparing.
Change-Id: Ib48364abee9f464c96c6fffd152e69bde4194df7
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/kernel')
-rw-r--r-- | src/network/kernel/qauthenticator.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp index a3ccf13e82..11ea40dbce 100644 --- a/src/network/kernel/qauthenticator.cpp +++ b/src/network/kernel/qauthenticator.cpp @@ -412,7 +412,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt QByteArray headerVal; for (int i = 0; i < values.size(); ++i) { const QPair<QByteArray, QByteArray> ¤t = values.at(i); - if (current.first.toLower() != search) + if (current.first.compare(search, Qt::CaseInsensitive) != 0) continue; QByteArray str = current.second.toLower(); if (method < Basic && str.startsWith("basic")) { @@ -443,7 +443,7 @@ void QAuthenticatorPrivate::parseHttpResponse(const QList<QPair<QByteArray, QByt break; case DigestMd5: { this->options[QLatin1String("realm")] = realm = QString::fromLatin1(options.value("realm")); - if (options.value("stale").toLower() == "true") + if (options.value("stale").compare("true", Qt::CaseInsensitive) == 0) phase = Start; if (user.isEmpty() && password.isEmpty()) phase = Done; @@ -630,7 +630,7 @@ static QByteArray digestMd5ResponseHelper( hash.addData(":", 1); hash.addData(password); QByteArray ha1 = hash.result(); - if (alg.toLower() == "md5-sess") { + if (alg.compare("md5-sess", Qt::CaseInsensitive) == 0) { hash.reset(); // RFC 2617 contains an error, it was: // hash.addData(ha1); @@ -650,7 +650,7 @@ static QByteArray digestMd5ResponseHelper( hash.addData(method); hash.addData(":", 1); hash.addData(digestUri); - if (qop.toLower() == "auth-int") { + if (qop.compare("auth-int", Qt::CaseInsensitive) == 0) { hash.addData(":", 1); hash.addData(hEntity); } |