Hsts: match header names case insensitively
Header field names are always considered to be case-insensitive. Pick-to: 6.5 6.5.1 6.2 5.15 Fixes: QTBUG-113392 Change-Id: Ifb4def4bb7f2ac070416cdc76581a769f1e52b43 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
5f6600fa26
commit
1b736a815b
@ -327,8 +327,8 @@ quoted-pair = "\" CHAR
|
||||
bool QHstsHeaderParser::parse(const QList<QPair<QByteArray, QByteArray>> &headers)
|
||||
{
|
||||
for (const auto &h : headers) {
|
||||
// We use '==' since header name was already 'trimmed' for us:
|
||||
if (h.first == "Strict-Transport-Security") {
|
||||
// We compare directly because header name was already 'trimmed' for us:
|
||||
if (h.first.compare("Strict-Transport-Security", Qt::CaseInsensitive) == 0) {
|
||||
header = h.second;
|
||||
// RFC6797, 8.1:
|
||||
//
|
||||
|
@ -216,6 +216,12 @@ void tst_QHsts::testSTSHeaderParser()
|
||||
QVERIFY(parser.expirationDate() > QDateTime::currentDateTimeUtc());
|
||||
QVERIFY(parser.includeSubDomains());
|
||||
|
||||
list.pop_back();
|
||||
list << Header("strict-transport-security", "includeSubDomains;max-age=1000");
|
||||
QVERIFY(parser.parse(list));
|
||||
QVERIFY(parser.expirationDate() > QDateTime::currentDateTimeUtc());
|
||||
QVERIFY(parser.includeSubDomains());
|
||||
|
||||
list.pop_back();
|
||||
// Invalid (includeSubDomains twice):
|
||||
list << Header("Strict-Transport-Security", "max-age = 1000 ; includeSubDomains;includeSubDomains");
|
||||
|
Loading…
Reference in New Issue
Block a user