Skip to content

Commit

Permalink
XHR: allow the user to set the User-Agent header
Browse files Browse the repository at this point in the history
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

* whatwg/fetch#37
* whatwg/fetch@dab09b0

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

Change-Id: I1d5bd785223e9df2883011f873d440a63e363a24
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Ulf Hermann <[email protected]>
Reviewed-by: Timur Pocheptsov <[email protected]>
Reviewed-by: Fabian Kosmale <[email protected]>
  • Loading branch information
dangelog authored and Inkane committed Oct 6, 2020
1 parent 6318809 commit d6091eb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/qml/qml/qqmlxmlhttprequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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-")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-";
Expand Down

0 comments on commit d6091eb

Please sign in to comment.