From d6091eb768a898377d191143ac8b43b1b666a2d7 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 1 Oct 2020 20:30:13 +0200 Subject: [PATCH] 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 * https://github.com/whatwg/fetch/commit/dab09b0c483c46324082df1e54b29ed4c9c02162 [ChangeLog][QtQml][XmlHttpRequest] It is now possible to set the User-Agent header. Change-Id: I1d5bd785223e9df2883011f873d440a63e363a24 Reviewed-by: Qt CI Bot Reviewed-by: Ulf Hermann Reviewed-by: Timur Pocheptsov Reviewed-by: Fabian Kosmale --- src/qml/qml/qqmlxmlhttprequest.cpp | 1 - tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 7a2f6f4537..bc2007b01a 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -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-"))) diff --git a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp index 27d626bd77..3892580f3c 100644 --- a/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp +++ b/tests/auto/qml/qqmlxmlhttprequest/tst_qqmlxmlhttprequest.cpp @@ -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-";