From cad7100fda1b27ba56c4d9efc6bceba62859dfbc Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 13 May 2018 21:53:07 -0700 Subject: QByteArray: add compare() with case sensitivity options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Timur Pocheptsov --- src/network/access/qhsts.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/network/access/qhsts.cpp') diff --git a/src/network/access/qhsts.cpp b/src/network/access/qhsts.cpp index 43a8a3663e..a015feb044 100644 --- a/src/network/access/qhsts.cpp +++ b/src/network/access/qhsts.cpp @@ -453,8 +453,7 @@ bool QHstsHeaderParser::processDirective(const QByteArray &name, const QByteArra { Q_ASSERT(name.size()); // RFC6797 6.1/3 Directive names are case-insensitive - const auto lcName = name.toLower(); - if (lcName == "max-age") { + if (name.compare("max-age", Qt::CaseInsensitive) == 0) { // RFC 6797, 6.1.1 // The syntax of the max-age directive's REQUIRED value (after // quoted-string unescaping, if necessary) is defined as: @@ -477,7 +476,7 @@ bool QHstsHeaderParser::processDirective(const QByteArray &name, const QByteArra maxAge = age; maxAgeFound = true; - } else if (lcName == "includesubdomains") { + } else if (name.compare("includesubdomains", Qt::CaseInsensitive) == 0) { // RFC 6797, 6.1.2. The includeSubDomains Directive. // The OPTIONAL "includeSubDomains" directive is a valueless directive. -- cgit v1.2.3