summaryrefslogtreecommitdiffstats
path: root/tests/auto/network/access
Commit message (Collapse)AuthorAgeFilesLines
* Improve test compilation setup with QtLite configurationJari Helaakoski4 days2-5/+58
| | | | | | | | Functional fix will come later via separate tasks. Task-number: QTBUG-122999 Change-Id: Ib805740c87ff21cea5a186add71cc594ab4d4df1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QNetworkRequest: add test for operator==()Lena Biliaieva7 days1-0/+127
| | | | | | Task-number: QTBUG-107751 Change-Id: I4ed77b022f9e576f1363d55a05de6f6fad5b01dc Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Use QHttpHeaders: Update internal users of QNRequest, QNReply, QNProxyLena Biliaieva7 days2-53/+57
| | | | | | | | | | | | | Replace QNetworkHeadersPrivate's main headers storage, which was RawHeadersList, with QHttpHeaders. Replace internal usage of raw and cooked header methods with the QHttpHeaders API. [ChangeLog][QtNetwork][QNetworkRequest] Header value added by QNetworkRequest::setRawHeader() method is trimmed now. Task-number: QTBUG-107751 Change-Id: I8882978afa430651e6c798a4fed00beef6c4cfd2 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Fix test compilation issues with QtLite configurationJari Helaakoski8 days3-4/+32
| | | | | | | | | | Now developer build tests compile, but some are not working. Functional fix will come later via separate tasks. Task-number: QTBUG-122999 Change-Id: I70487b46c1b32ba4279cb02a4978e4f55ac0d310 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QDebug support to QHttpPartMate Barany11 days1-0/+56
| | | | | | | | | | | | | | | | | | As part of QTBUG-114647 we are planning to introduce a deduction mechanism that could deduce the contentType header and the contentDisposition headers based on the arguments (and the MIME database). In case of non-trivial types this deduction may give the wrong result and without QDebug support it might be a bit tedious to check. The debug output displays some information about the body device if one is attached, otherwise it displays the size of the body. Task-number: QTBUG-114647 Change-Id: Ia693b078ff5b9f8ea57fbf3c385edaec47886ff1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QRestReply: allow comments where white-space is allowedMarc Mutz12 days1-1/+1
| | | | | | | | | | | | | This is RFC2822 grammar (except that line folding is not allowed). RFC9110 doesn't allow it anymore, but it might make sense to accept it nonetheless (Postel's Law). Pick-to: 6.7 Task-number: QTBUG-123544 Change-Id: Ie990cd332c7603dbdae29c19b2804bd33a058ca0 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Add QHttpHeaders methods to QNetworkCacheMetaDataLena Biliaieva12 days1-1/+50
| | | | | | | | | | | [ChangeLog][QtNetwork][QNetworkCacheMetaData] Added headers() and setHeaders() methods to QNetworkCacheMetaData to provide an interface to work with QHttpHeaders. Task-number: QTBUG-107751 Change-Id: I1dfed5c2e03f4912de0da96156425cd6b713c1d5 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Add QHttpHeaders to QNetworkRequestLena Biliaieva2024-04-294-0/+121
| | | | | | | | | | | | Added headers() and setHeaders() methods to QNetworkRequest. [ChangeLog][QtNetwork][QNetworkRequest] Added headers() and setHeaders() methods to QNetworkRequest, which provide an interface to work with QHttpHeaders. Task-number: QTBUG-107751 Change-Id: I2e1dc7cb2efab5903eb7ff23b75d01aefe13273d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QRestReply: make charset parsing more robustMarc Mutz2024-04-261-10/+3
| | | | | | | | | | | | | | | | | | | | | | The old code was based on QString::split and e.g. didn't handle escapes in quoted-strings. Write a modern recursive-descent parser to parse out type/subtype and charset parameter. Since we don't, yet, support CFWS (see below), recursion depth is strictly limited, so we're not susceptible to recursion bombs here. It currently handles only RFC9110-style grammar, but can be easily extended to support CFWS (RFC2822-style comments and folding white-space) or RFC2231-style continuuations, if needed. It's a bit more general than strictly required, because I expect this to be reused elsewhere ere long. Pick-to: 6.7 Fixes: QTBUG-120307 Change-Id: I309928dc350a043672dffb4a259b457764c031be Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* QRestReply: add a few more content-type parsing testsMarc Mutz2024-04-241-3/+36
| | | | | | | | | | | | ... incl. some that fail. This is in preparation of a patch that makes the parser more compliant. Pick-to: 6.7 Task-number: QTBUG-120307 Change-Id: Ic47b23132f2a7ea81b6c480bfb036bc2daff05da Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Http2: fix handling unsuppported authenticate challengeMårten Nordheim2024-04-201-0/+86
| | | | | | | | | | | When adding/fixing parts earlier it was missed that it was not handling the _unsupported_ case, when authentication is not handled and there is no resend. But there _is_ a challenge header. Pick-to: 6.7 6.6 6.5 Fixes: QTBUG-123891 Change-Id: I21470df0ce2528bad3babffc6e9f19b7afd29d20 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* HttpTestServer: pass std::function by value and move into placeMarc Mutz2024-04-182-5/+3
| | | | | | | | | | | | | | | | Virtually all callers of this function (will) pass rvalues, so take the std::function by value (reaping C++17 guaranteed copy elision) and std::move() into the member variable ("perfect sink"). Like for many owning types, moves are much cheaper than copies for std::function, because the external state is merely tranferred between objects, and not copied. Amends e560adef213301318dcc13d4db155624846e0420. Pick-to: 6.7 Change-Id: I269b54e51ba09ac595ac4e4f255209778819adad Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* tst_QRestAccessManager: fix signature of server handlersMarc Mutz2024-04-181-6/+6
| | | | | | | | | | | | | HttpTestServer::Handler is declared to take the first argument by reference to const, not by value, so use the same parameter passing for the lambdas passed to setHandler(). Avoids copying the (rather large) argument when invoked through the std::function wrapper, and silences clazy-function-args-by-ref. Pick-to: 6.7 Change-Id: I726d0b98a7fcb3b1b33c5bde203035f593c39bdd Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* tst_QRestAccessManager: leak less on failureMarc Mutz2024-04-181-7/+8
| | | | | | | | | | | | | | | Move some deleteLater() calls to before the first QCOMPARE/QVERIFY macros, so they get executed even if the macros return on failure. This isn't an all-encompassing solution, but I lack the time to port all this to smart pointers, and this is some improvement. As a drive-by, port QVERIFY(opt.has_value()) to QCOMPARE(opt, nullopt). Task-number: QTBUG-120307 Pick-to: 6.7 Change-Id: Ia5a2cabd273a779938b22badc91b109fcc545203 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* tst_QHttpNetworkConnection: Move to use only one ctorMårten Nordheim2024-04-171-9/+9
| | | | | | | | | We want to get rid of the other one, it's all internal API anyway. Task-number: QTBUG-102855 Change-Id: I2b621c20f4dd7c8bf5f07db8db908c2b7b86976f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Tests: make some QFile::open calls failGiuseppe D'Angelo2024-04-133-3/+10
| | | | | | | | | | In some cases calls to QFile::open are made outside of a testfunction (so we can't use QVERIFY), or even in standalone executables that are executed by tests. Make them fail "visibly". Change-Id: Iec4d56f6d874be16aa2e9ad6974eeec2a98caa3f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QHttp2Connection: fix handling of replies on locally initiated streamMårten Nordheim2024-04-111-0/+3
| | | | | | | | | | It was overlooked in testing, but it would emit a signal for new incoming stream even if the server was just replying with HEADERS on a stream the client had initiated. Or vice-versa. Pick-to: 6.7 Change-Id: Ie7b3a45729a78106da1d8c058e15705cc7dcc53b Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* tst_qnetworkreply: verify we can open the local file for comparisonGiuseppe D'Angelo2024-04-031-1/+3
| | | | | | | ... except for bigfile. Change-Id: Ide04a9c80b438272e868a6d2b410a507c76d6239 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Tests: check the output of QFile::openGiuseppe D'Angelo2024-03-271-4/+4
| | | | | | | | | | Wrap the call in QVERIFY. tst_QTextStream::read0d0d0a was also faulty as it *never* opened the file because of a broken path. Fix it with QFINDTESTDATA. Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QNetworkReply: don't leak on failure in emitErrorForAllReplies()Marc Mutz2024-03-211-20/+22
| | | | | | | | | | | | | | | | | The old code allocated QSignalSpies on the heap and stored them in a non-owning container, so if one of the many check macros trigger, those objects would be leaked. Ditto QNetworkReplies. The code also used dynamically-sized containers for statically-sized data; a common anti-pattern. Hold the sample QUrls in a C array instead, QSignalSpies in C arrays of std::optional (to delay initialization) and QNetworkReplies in a C array of std::unique_ptr with the existing QScopedPointerDeleteLater deleter. Pick-to: 6.7 Change-Id: I7305115af15c079abba6d45c5de8db2198ea7a6d Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* tst_QNetworkReply: don't use deleteLater() on QSignalSpiesMarc Mutz2024-03-201-2/+2
| | | | | | | | | | | | | | | Turn the QSignalSpy deletions from deferred (via deleteLater()) into immediate ones. This is ok: QSignalSpy is using itself as a context object in QMetaObject::connect(), so the connection thus established to the monitored signal will be atomically severed if either sender or receiver are destroyed. There never was a need to defer deletion of the signal spy, so don't. Found by making QSignalSpy's inheritance from QObject private. Pick-to: 6.7 6.6 6.5 Change-Id: I962d28c3a78f356d234324fed68716f2f1052100 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QNetworkReply: use QtCore's QScopedPointerDeleteLaterMarc Mutz2024-03-201-10/+2
| | | | | | | | ... instead of rolling your own. Pick-to: 6.7 6.6 6.5 Change-Id: I4fee2218eb874bfee34bd3a0abac3f85b0746540 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add a means to send a PUT request with an empty bodyMate Barany2024-03-191-0/+44
| | | | | | | | | | | We have implemented the same functionality recently for POST, in this patch implement it for PUT. Task-number: QTBUG-108309 Change-Id: I34c41538054fec836d0d1d1dbb44fabab9bc0e9a Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add a means to send a POST request that has an empty bodyMate Barany2024-03-191-0/+47
| | | | | | | | | | | Actually this has already worked if a nullptr was casted as a QIODevice*. Add an overload with a nullptr_t type, that does this behind the scenes. Fixes: QTBUG-108309 Change-Id: I2d4b17ae94cf4de2c42257d471ef901c8994fee5 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_qnetworkreply::httpConnectionCount: tentatively increase timeoutMårten Nordheim2024-03-181-1/+1
| | | | | | | | | | | | It is failing a bunch on macOS in CI, but not locally. So just assuming the timings are too tight in CI and increasing them. Amends 8de1ed89797cabc883b5651673daa747f6ee9c0e Pick-to: 6.7 Change-Id: Icb44fdbd2aa117de7350c5df2e8351bb19c865c4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_QNetworkReply: cleanup changed state from timeout testMårten Nordheim2024-03-141-0/+1
| | | | | | | | | | | | | | It was not setting the value _back_ to 0 when the function ended and this caused qtbug68821proxyError to fail fairly consistently on Windows when it was running in the same run. qtbug68821proxyError was always succeeding when ran by itself so it was quite odd. Pick-to: 6.7 Change-Id: Ifa4982f1b10128674081136a30bdab4b0ce7004a Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* CMake: Make a few more auto tests standaloneAlexandru Croitor2024-03-143-0/+18
| | | | | | Pick-to: 6.7 Change-Id: I80988114bd906447a2ab712d5432a489e095a5c1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* tst_QNetworkReply: update and speed up httpConnectionCountMårten Nordheim2024-03-121-15/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | Because we will do a small wait after the final connection (to see if there are any unexpected extra connections) we can save some time by reducing _how long_ we wait for it. In general we only need an extra long wait for the first connection, subsequent connections are faster. So we change the loop structure from looping until we hit 20(!) connections, when anything larger than 6 will fail the test anyway! And use qWaitFor instead of repeatedly calling enterLoop and checking the state of an ElapsedTimer, the total wait time is not super interesting, and made it a guarantee that the test would take 10 seconds. While we are here, update the attribute we use to test HTTP/2 connections. We were previously enabling http/2, but this is the new default so it's not needed. We do, however, need to enable h2c if we want to see it trying to upgrade to http/2 over cleartext. Not a big issue, so we don't pick it very far back. Pick-to: 6.7 Change-Id: Ia314ae2827ab8a8baaa4af2c5136c5e531bcb1f8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Http: fix issues after early abort()Mårten Nordheim2024-03-121-0/+35
| | | | | | | | | | | | | | | | | | | | There were a few issues to deal with. One of them was that we would print a warning about an internal error if we tried to *set* an error on the reply after it had been cancelled. That's kind of unavoidable since these things happen in different threads, so just ignore the error if we have been cancelled. The other issue was that, for a request with data, we will buffer the data to send, and _only then_ do we start the request. This happens asynchronously, so the user can abort the request before it has finished buffering. Once it finished buffering it would set the state of the request to "Working", ignoring that it was already marked "Finished". Fixes: QTBUG-118209 Fixes: QTBUG-36127 Pick-to: 6.7 6.6 Change-Id: Idbf1fd8a80530d802bee04c4b0a6783cba4992d3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Add a QHttpHeaders convenience method for unique header name settingJuha Vuolle2024-03-071-0/+60
| | | | | | | | | | | | | | | | | | | | | | The function replaces one of the found entries with the new value, and removes any other entries. If no entries are found, a new entry will be appended. The replacement search is done for performance reasons; it's cheaper to replace an existing value. All in all the function is a more convenient and performant alternative for this sequence (which proved to be common while porting QtNetwork internals to QHttpHeaders): header.removeAll(<headername>); header.append(<headername>, <value>); [ChangeLog][QtNetwork][QHttpHeaders] Added replaceOrAppend() convenience method, which either replaces previous entries with a single entry, or appends a new one if no entries existed Fixes: QTBUG-122175 Change-Id: I03957645d7e916a732ac7b8d3ae724bb6b16af87 Reviewed-by: Lena Biliaieva <lena.biliaieva@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Implement ping reply in QHttp2Connection and add testMatthias Rauter2024-03-041-0/+30
| | | | | | | Fixes: QTBUG-122338 Change-Id: I1e8dfa8a93c45dbe12a628d4d5e79d494d8f6032 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Handle informational HTTP replies (1xx) for HTTP/2Mate Barany2024-03-013-0/+94
| | | | | | | | | | | | | | | | Make QHttp2ProtocolHandler discard all informational (1xx) replies with the exception of 101. According to RFC 9110: "A client MUST be able to parse one or more 1xx responses received prior to a final response, even if the client does not expect one. A user agent MAY ignore unexpected 1xx responses." Fixes: QTBUG-121755 Change-Id: I8b8d578f23d4fbe28929f8c54b3607bcaf85405f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Add QNetworkRequest attribute support to QNetworkRequestFactoryJuha Vuolle2024-02-281-0/+51
| | | | | | | | | | [ChangeLog][QtNetwork][QNetworkRequestFactory] Add QNetworkRequest attribute support to QNetworkRequestFactory Fixes: QTBUG-122397 Change-Id: Ie73f104cdad9f8f0721d8ee28f79095bfb04fb3c Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add space character when combining QHttpHeaders values with commaJuha Vuolle2024-02-272-5/+5
| | | | | | | | | | | | | | The "HTTP RFC 9110 5.3 Field Order" states that the values combined with comma can be followed up by an optional whitespace, and for consistency recommends "comma SP". This is also what eg. 'MDN Web Headers' class does. Fixes: QTBUG-122650 Pick-to: 6.7 Change-Id: I3391c86018090f0b8721929b64a7e3029e98ac85 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_QNetworkReply: Try to stabilize qtbug68821proxyErrorMårten Nordheim2024-02-151-5/+12
| | | | | | | | | | | | | | | | | | | | | | | The test is a bit silly, it was originally written to make sure that we produce meaningful errors when trying to connect to a proxy server where the connection is refused or the server doesn't respond at all. To test that, it creates a local QTcpServer and starts listening to any free port (by specifying port 0) and then it closed the server and uses the address-port of localhost:serverPort as the proxy to use, since we know it _was_ unused, since we were able to bind to it. However, just calling close() doesn't immediately tear down the internal socket descriptor, so the OS may still have the port reserved for some time. By moving the QTcpServer to a narrower scope we will quickly destroy it and the internal socket engine, which is parented to the server, and this in turn releases the socket descriptor. Pick-to: 6.7 6.6 6.5 Change-Id: If12128fc21d1f545df152f08f0d52c1b14ac6037 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
* Add QNetworkRequestFactory::(set)?PriorityMårten Nordheim2024-02-081-0/+14
| | | | | | | | | To enable setting a default priority for all requests to a given site. Fixes: QTBUG-121669 Change-Id: Icd8a9c59e4afb0432c65f84cc8115ae0c7f85506 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Remove HTTP 1XX status test from tst_qrestaccessmanagerJuha Vuolle2024-02-061-1/+0
| | | | | | | | | | | 1XX statuses are not final statuses, and testing 'error' on it is not necessarily very meaningful. Furthermore the internal handling of these statuses changes in Qt 6.8. Fixes: QTBUG-108068 Pick-to: 6.7 Change-Id: I9c18c579cd310266273eccd2aee2e032f60538e0 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make QNAM handle all informational HTTP repliesMate Barany2024-02-061-4/+20
| | | | | | | | | | | | | | | | | | | Make QNetworkAccessManager to discard all informational (1xx) replies from HTTP servers with the exception of 101. According to RFC 9110: "A client MUST be able to parse one or more 1xx responses received prior to a final response, even if the client does not expect one. A user agent MAY ignore unexpected 1xx responses." Status code 101 is an exception because we use it to upgrade to http2 cleartext when it is enabled. Fixes: QTBUG-108068 Change-Id: I415ff053180a43f0c7ff1b4b2a60fd114ce08ac9 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Change license for tests filesLucie Gérard2024-02-0422-22/+22
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Take QJsonDocument as a parameterJuha Vuolle2024-01-301-7/+7
| | | | | | | | | | | Instead of separate QJsonObject and QJsonArray types. Resulted from API-review Pick-to: 6.7 Change-Id: I977d692d3709a8c3aa872683ddda54a143c25e67 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Rename QRestReply data accessors as read* functionsJuha Vuolle2024-01-301-17/+17
| | | | | | | | | | | | This naming should make it clearer that (successful) calls to readJson(), readBody(), and readText() consume the data received so far. Resulted from API-review Pick-to: 6.7 Change-Id: I09ca9eac598f8fc83eecb72c22431ac35b966bf5 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Make QRest* APIs non-owning and non-duplicatingJuha Vuolle2024-01-291-553/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: documentation will be updated in a follow-up commit This commit makes QRestReply and QRestAccessManager classes lighter, non-owning wrappers. Furthermore their APIs don't duplicate the wrapped QNetwork* APIs. This makes it easier to use / opt-in to these helpers in pre-existing applications which are based on QNetworkAccessManager and QNetworkReply. Since APIs are no longer duplicated, the QRest classes are more obviously a convenience _wrapper_, as opposed to being an alternative vertical stack. In practice this change consists of: - QRestAM never instantiates QNetworkAccessManager, but accepts it via constructor. It does not take ownership of the QNetworkAccessManager. - QRestReply accepts QNetworkReply via constructor. It does not take ownership of the QNetworkReply - Signals and most duplicated functions are removed from both QRestAM and QRR. - QRestReply is no longer a QObject - Since QRestAM doesn't have much to report anymore, the debug operator is dropped. Resulted from API-review Pick-to: 6.7 Change-Id: Ib62d9cc2df41cac631396a84bb7ec4d2d54b0c8c Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Update public suffix listMårten Nordheim2024-01-291-0/+0
| | | | | | | | | | | | | | Version 883ced078a83f9d79a98933145425c221a5e51f0, fetched on 2024-01-25. [ChangeLog][Third-Party Code] Updated the public suffix list to upstream SHA 883ced078a83f9d79a98933145425c221a5e51f0. Pick-to: 6.7 6.6 6.5 6.2 5.15 Task-number: QTBUG-121325 Change-Id: I95e82b5c351218c1641e11e7a166ae21be2c5ad6 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Http2: fix 401 authentication required w/o challengeMårten Nordheim2024-01-253-6/+26
| | | | | | | | | | | | | The code did not handle the path where we didn't have a challenge. We cannot recover from that so we just have to fail the request. Amends fe1b668861e8a3ef99e126821fcd3eeaa6044b54 Pick-to: 6.7 6.6 6.6.2 6.5 6.2 Fixes: QTBUG-121515 Change-Id: Ie39a92e7439785a09cad28e8f81599a51de5e27f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Network: Use QHttpHeaders in QHttpHeaderParserLena Biliaieva2024-01-256-88/+102
| | | | | | | | | | | | | QHttpHeaderParser::headers() method is changed to return QHttpHeaders. QAuthenticatorPrivate::parseHttpResponse() method is changed to work with QHttpHeaders. QHttpNetworkHeader::header() method is updated to return QHttpHeaders. Tests are updated. Task-number: QTBUG-120133 Change-Id: I20a18b509acd7a8b8d93884cff8349519d64293e Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* Remove QHttpHeaders::names()Juha Vuolle2024-01-201-21/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need a way for users to consume the complete contents of QHttpHeaders. Until now, the only way was for (const auto &name : h.names()) use(h.value/combinedValue(name)); which is quadratic. Adding the usual iterators and operator[] would require us to expose the underlying value_type, which we're not ready to do, yet. So we added nameAt() and valueAt() functions in previous commits to enable efficient indexed iteration without the need to expose a value_type. Having added those, we can now remove names(), which had the wrong value_type (QByteArrays are by definition UTF-8 in Qt, while header names are L1), and is no longer needed to facilitate iteration. In QNetworkRequestFactory, temporarily use toMultiMap() because we need the combinedValue() of all headers here. The fix will be to make QNetworkRequest QHttpHeaders-aware, but that's a Qt 6.8 thing, even though we should still de-pessimize this code for Qt 6.7 with private API. Resulted from API-review. Pick-to: 6.7 Change-Id: I65086ef4c62e22554ae7325a846bebc08b44916f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add QHttpHeaders::nameAt() functionJuha Vuolle2024-01-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need a way for users to consume the complete contents of QHttpHeaders. For now, the only way is for (const auto &name : h.names()) use(h.value/combinedValue(name)); which is quadratic. Adding the usual iterators and operator[] would require us to expose the underlying value_type, which we're not ready to do, yet. So add nameAt() and (in a previous commit) valueAt() functions to enable efficient indexed iteration without the need to expose a value_type. Return by QLatin1StringView, not QAnyStringView, because that statically encodes the actual encoding used (and required by HTTP specs and promised by the class documentation, so it won't need to change). For the setters, we want to be accomodating QString, QByteArray, etc, which is why those take QAnyStringView. Resulted from API-review. Pick-to: 6.7 Change-Id: I0153c5aad0f6260b5dbc963de0aaf4ef42fdd4f1 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
* Add QHttpHeaders::valueAt() functionJuha Vuolle2024-01-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | We need a way for users to consume the complete contents of QHttpHeaders. For now, the only way is for (const auto &name : h.names()) use(h.value/combinedValue(name)); which is quadratic. Adding the usual iterators and operator[] would require us to expose the underlying value_type, which we're not ready to do, yet. So add valueAt() and (in a follow-up) nameAt() functions to enable efficient indexed iteration without the need to expose a value_type. Resulted from API-review Pick-to: 6.7 Change-Id: I863f59618cea5682386ce26b66b4b1655eac7950 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Add missing include in tst_QHttpHeadersAxel Spoerl2024-01-181-0/+1
| | | | | | | | | | | A QMultiMap is used, while only qset.h is included. FTBFS w/o precompiled headers. Include qmap.h as well. Pick-to: 6.7 6.6 6.5 Change-Id: I5f6e1d204bfa94cc6a81f6883c7a7b0ee1e9963c Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Privately introduce QHttp2ConnectionMårten Nordheim2024-01-173-0/+381
| | | | | | | | | | | | | | | For use in QtGRPC. There is some duplication between this code and the code in QHttp2ProtocolHandler. But let's not change the implementation of the protocol handler after the 6.7 beta release. Nor do I think we should do it for 6.8 LTS. So let's just live with the duplication until that has branched. Pick-to: 6.7 Fixes: QTBUG-105491 Change-Id: I69aa38a3c341347e702f9c07c27287aee38a16f2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>