XHR: allow the user to set the User-Agent header

The Fetch spec has allowed it for a while (in other words,
it's no longer forbidden):

* https://fetch.spec.whatwg.org/#terminology-headers
* https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name

Cf. also

* https://github.com/whatwg/fetch/issues/37
* dab09b0c48

[ChangeLog][QtQml][XmlHttpRequest] It is now possible to set the
User-Agent header.

Change-Id: I1d5bd785223e9df2883011f873d440a63e363a24
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2020-10-01 20:30:13 +02:00 committed by Fabian Kosmale
parent 6318809df1
commit d6091eb768
2 changed files with 0 additions and 2 deletions

View File

@ -1855,7 +1855,6 @@ ReturnedValue QQmlXMLHttpRequestCtor::method_setRequestHeader(const FunctionObje
nameUpper == QLatin1String("TRAILER") ||
nameUpper == QLatin1String("TRANSFER-ENCODING") ||
nameUpper == QLatin1String("UPGRADE") ||
nameUpper == QLatin1String("USER-AGENT") ||
nameUpper == QLatin1String("VIA") ||
nameUpper.startsWith(QLatin1String("PROXY-")) ||
nameUpper.startsWith(QLatin1String("SEC-")))

View File

@ -455,7 +455,6 @@ void tst_qqmlxmlhttprequest::setRequestHeader_illegalName_data()
QTest::newRow("Trailer") << "TraILEr";
QTest::newRow("Transfer-Encoding") << "tRANsfer-Encoding";
QTest::newRow("Upgrade") << "UpgrADe";
QTest::newRow("User-Agent") << "uSEr-Agent";
QTest::newRow("Via") << "vIa";
QTest::newRow("Proxy-") << "ProXy-";
QTest::newRow("Sec-") << "SeC-";