qnetworkrequest: port parseHeaderName to QBAV

Change-Id: I39af8649468636d09db46aac770f5df7a3582b50
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Anton Kudryavtsev 2023-08-23 19:19:06 +03:00
parent 49e52e8dd6
commit 8db5896bbe

View File

@ -1127,13 +1127,13 @@ static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVaria
return QByteArray();
}
static int parseHeaderName(const QByteArray &headerName)
static int parseHeaderName(QByteArrayView headerName)
{
if (headerName.isEmpty())
return -1;
auto is = [&](const char *what) {
return qstrnicmp(headerName.data(), headerName.size(), what) == 0;
auto is = [headerName](QByteArrayView what) {
return headerName.compare(what, Qt::CaseInsensitive) == 0;
};
switch (QtMiscUtils::toAsciiLower(headerName.front())) {