Commit Graph

610 Commits

Author SHA1 Message Date
Mårten Nordheim
b322984b49 tst_QNetworkReply try stabilize autoDeleteReplies tests
The http test data hasn't always been stable but for some reason
it fails far more than usual.

Originally the domain was a non-existing one, because it would then work
on any machine (even if not in CI) and would finish() (with error)
after failing to look up the domain in DNS. However, some machines in CI,
for some reason, take too long to do this and end up failing the test.

So, we change the URL to point to the network server in CI. This should,
at the very least, finish quickly when running in CI.

Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-102952
Change-Id: I3b3f6fa23acf78fefdb69ff9ae7722f15e5f1736
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-04-29 04:28:56 +00:00
Mårten Nordheim
41d217829c QHttp: Fix handling of redirect loaded from cache
In some situations when loading a redirect from cache which would lead
to a real request we would not emit the finished() signal because the
replyFinished function has a pre-condition that the response did
not originate from the cache.
However, after the initial redirect was loaded from the cache we never
unset the 'loadingFromCache' boolean, so it was still true after the
request had been made to the real target.

Pick-to: 6.2 6.3 5.15
Change-Id: I015a2ebae4af4bd17392182c3951e875a7b353c4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-04-27 18:31:01 +02:00
Mårten Nordheim
d642c16fe7 QNetworkReply: update decompress error message and handling
The error message was quite vague since it would then not require
any additional translations. However, in hindsight this was a mistake
since now developers just thought their downloads were being corrupted.

Pick-to: 6.2 6.3
Fixes: QTBUG-101942
Change-Id: Ie9af42510ca027d15248e5bcf21e836e709898d9
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-04-27 18:31:01 +02:00
Sona Kurazyan
80363889fe Replace uses of _qba with _ba
Task-number: QTBUG-101408
Change-Id: I5175428c2be934b09f45bd06b0b47643003e25c7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-04-07 19:30:17 +02:00
Sona Kurazyan
a885f28933 Replace uses of _qs with _s in tests
Task-number: QTBUG-101408
Change-Id: If092a68828a1e8056259cf90d035d9a87989244b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-04-07 19:30:17 +02:00
Fabian Kosmale
819e1bf91d Tests: Do not depend on transitive includes
Change-Id: Ibc6a948480a904913a5427e6408d4d296784fb4f
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-17 17:14:37 +01:00
Sona Kurazyan
6585963583 Deprecate {QString, QByteArray}::count()
And remove their uses.

[ChangeLog][QtCore][Deprecation Notice] Deprecated QString::count()
and QByteArray::count() that take no parameters, to avoid confusion
with the algorithm overloads of the same name. They can be replaced
by size() or length() methods.

Change-Id: I6541e3235ab58cf750d89568d66d3b1d9bbd4a04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-12 01:05:45 +01:00
Ievgenii Meshcheriakov
16b614f2e1 Network: Use system publicsuffix database copy when available
[ChangeLog][Network][QNetworkCookieJar] It is possible to use
system's copy of publicsuffix database when it is available.
This behavior is enabled by default on Linux and can be
controlled using new command line switches -system-publicsuffix,
-qt-publicsuffix, -no-publicsuffix, and -publicsuffix=all.

Fixes: QTBUG-95889
Change-Id: I911e1a13c1422cdc35851953309fff064e7c5f26
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-03 15:56:09 +01:00
Ievgenii Meshcheriakov
d0b22762be tst_qnetworkcookiejar: Remove tests that rely on public suffix database format
This format will be changed by the next commit. Also it is an
implimentation detail that can be changed at any time.

Task-number: QTBUG-95889
Change-Id: I00b1133078f1035e03e2cd6fae28192de54d2154
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-24 19:36:26 +01:00
Mårten Nordheim
db5b8bbea3 Http2: Fix redirect-handling
The redirect handling for http2 was a little simple. E.g. not handling
relative URLs.
Fix this using the redirect response parsing function which the http1
protocol handler already uses.

Fixes: QTBUG-100651
Pick-to: 6.3 6.2 5.15
Change-Id: Ic0cec4cacc92707e7a7fde1f4665f80995a6057e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-20 22:47:25 +01:00
Mårten Nordheim
9078b41dde QHttp: Move the emission of requestSent
Moved to after the header is actually written, not just generated.
For requests with data (put/post) we may have to wait for a callback
before the data to write is available. Since we then delay writing the
header as well it would be disingenuous to emit requestSent().

Pick-to: 6.3
Change-Id: I76c2d40ca48faaa1f6730ce8b3d5a8a4c3156f8f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-18 13:44:41 +01:00
Mårten Nordheim
50c8ec9fa4 QAbstractSocket: Don't pretend pause and resume is a stack
It only stores one layer of state, and pausing twice in a row will just
overwrite the previous state. This doesn't happen often but can happen,
especially on Windows if a certificate needs to be looked up in the system
certificate stores (socket gets paused) and then a recoverable error
occurs in QNAM (socket gets paused again).

Fixes: QTBUG-100362
Fixes: QTBUG-63196
Fixes: QTBUG-98476
Pick-to: 6.3 6.2 5.15
Change-Id: Ie524c48e11b6fa8010b78cc1bf3931efe2ce3351
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-09 22:26:20 +01:00
Pasi Petäjäjärvi
39310a6817 Handle situation when device running test does not have enough RAM
CI tests for QNX are run in QEMU which does not have enough RAM
to run this test successfully.

Pick-to: 6.2 6.3
Change-Id: Idab3e8b6a1e0ae3eddf5aedb82e6784a74ae9a3a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-09 14:17:53 +00:00
Fabian Kosmale
987b896b4e Blacklist putWithServerClosingConnectionImmediately on Windows
Task-number: QTBUG-100362
Change-Id: Ib09aec5ea03867163d476a2c92562bc949fc1b1a
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-02 05:25:06 +01:00
Mårten Nordheim
8437c27582 QNetworkReply: rename socketConnecting to socketStartedConnecting
From the API review.

Pick-to: 6.3
Change-Id: Ic05737db79327e7811fcd974a70914b837e06601
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-31 14:24:11 +01:00
Joerg Bornemann
238e3beb6f Remove unused .qrc files
Task-number: QTBUG-94446
Change-Id: I136d8b4ab070a832866aa50b5701fc6bd863df8a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-01-17 23:17:01 +01:00
Edward Welbourne
aa8fd6bc39 Convert date-time to UTC before claiming it's in GMT
QNetworkHeadersPrivate::toHttpDate() used a custom format to output a
date-time; the format supplied GMT as suffix, but neglected to convert
the date-time to UTC, so local-time was formatted as if it were UTC,
regardless of its actual offset from it. Fixing this (by the obvious
toUTC() call) broke formatting when the supplied header value was a
QDate, since it's packaged as a QVariant and QVariant's conversion of
QDate to QDateTime uses local time's (not UTC's) start of day. So fix
headerValue() to separate QDate and QDateTime cases and use
startOfDay(Qt::UTC) to get the right start of the day. Added tests for
non-UTC date-times appearing correctly in HTTP headers.

Fixes: QTBUG-80666
Pick-to: 6.3 6.2 6.2.3 5.15
Change-Id: I2792bce14a07be025cf551b0594630260c112269
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-01-17 22:29:30 +01:00
Mårten Nordheim
9909ec0bc6 QNAM: Reintroduce h2c with an attribute
[ChangeLog][QtNetwork][QNetworkRequest] Added
QNetworkRequest::Http2CleartextAllowedAttribute which controls whether
HTTP/2 cleartext (h2c) is allowed or not. The default is false. This
replaces the QT_NETWORK_H2C_ALLOWED environment variable.

Task-number: QTBUG-98642
Change-Id: I43ae1cc671788f6d2559cd316f6667b412c8e75e
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-12-04 08:20:52 +00:00
Mårten Nordheim
4c930e9d13 QNAM: Disable h2c by default
And since it's relatively unlikely to be used, just leave it
behind a environment variable for now.

[ChangeLog][QtNetwork][Potentially Source-Incompatible] Support for
clear-text http/2 was disabled due to incompatibility with certain
servers. If you were relying on this feature you must re-enable it by
setting the QT_NETWORK_ALLOW_H2C environment variable. For a later
version of Qt it will get a dedicated attribute.

Pick-to: 6.2
Task-number: QTBUG-98642
Change-Id: Id3e360726e285b3128e3e3f4bce9440404c9ad6e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-11-30 00:04:38 +01:00
Øystein Heskestad
18aff2b424 Add more verification when parsing http headers and add tests
Adding tests from QtWebSockets that will reuse QHttpHeaderParser

Task-number: QTBUG-80700
Change-Id: I76294a9156173314a3cf09160d0ca4e0d7c6ef3a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-11-19 19:31:34 +01:00
Timur Pocheptsov
dd57605b9e Http/2 - handle PADDED flag correctly
Previously, when deciding where the actual data is, Frame was calling
padding() to test if offset is needed. A curious case with a DATA frame
containing compressed body and having 'PADDED' flag set with a padding
equal to ... 0, ended in a decompression error (and assert in 6.2 code).

Pick-to: 6.2 5.15
Fixes: QTBUG-97179
Change-Id: I9341a4d68510aa4c26f4972afdcd09a530d5a367
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-09 12:49:01 +02:00
Volker Hilsheimer
af31b6cf05 Silence compiler warning from int/size_t mismatch
Amends 4757b93b0e.

Change-Id: I678785cd61dbdecb3b1e7e68c7daf9f18cad4d02
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-10-07 00:49:17 +02:00
Tatiana Borisova
766904bf5b Compile autotests for Integrity
- process environment/DNS are OFF for INTEGRITY

Task-number: QTBUG-96176
Pick-to: 6.2
Change-Id: I189a97f88c96a428586c31a66b8d250e04482900
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 17:29:04 +03:00
Mårten Nordheim
c942bae4eb tst_http2: Fix flaky authentication test
The h2 server is running in a separate thread, so while the previous
test was finished and the server was deleted, it could still emit
and have a queued emission in-flight which would be picked up by
the next running test.

Pick-to: 6.2 6.1 5.15
Change-Id: I26b1bc711df7473032d6078f35f8aca37c40137e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-09-10 14:17:05 +00:00
Øystein Heskestad
9a602e68cf Move QNAM's http header parsing into separate class
Fixes: QTBUG-80701
Change-Id: I43f5e102c15d121dba74e07e3cd4bb8aded1c763
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-09 16:55:50 +02:00
Mårten Nordheim
9258c50936 tst_QNetworkReply: Remove and suppress one debug message
There's not much context to the URLs being printed, so remove the
message. And suppress the message coming from the MiniHttpServer

Change-Id: Ie2025ac717657ed0f2f0163bd0af22e12a49b30f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-09-01 18:03:15 +02:00
Mårten Nordheim
4757b93b0e Test QNetworkAccessCache insertions with varying expiry times
The insertions are sorted by when they expire. So, we test the various
orders to insert entries.

Fixes: QTBUG-95959
Change-Id: I1e8d7f4c77dce5eae3d4bfa5101f296c3eea1961
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-01 18:03:15 +02:00
Ievgenii Meshcheriakov
c859b335b9 tests: Use QT_TESTCASE_SOURCEDIR define
Replace custom SRCDIR define with QT_TESTCASE_SOURCEDIR. The latter is
automatically available to all tests to use and serves the same purpose
but is not terminated by a slash.

Change-Id: I62896d0fd84ac63ac1b74a459ec1646c6bde0a46
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-08-11 21:03:56 +02:00
Mårten Nordheim
b41d5f6293 QDecompressHelper: Skip double-decompression if download is small
To retain backwards compatibility with some QNetworkReply usage,
namely connecting solely to finished-signal and allocating a buffer to
read into, but without storing the entire decompressed file in memory
until read, we may decompress the file twice.

With this patch users can now avoid this double decompression if the
amount of buffered data stays below 10 MiB. This means any file smaller
than 10 MiB will never need to be decompressed twice to know the size of
it. On top of that, if the data is handled as it arrives (e.g. in
readyRead) and the buffer is kept below 10 MiB it won't need to
decompress twice either.

This is active as long as "countDecompressed" is true, though it
currently always is in QNetworkAccessManger, with a future goal to make
it possible to control with public API. Since it requires the user to
potentially adapt their usage of QNetworkReply.

In this patch we also stop tracking the amount of unhandled uncompressed
bytes (uncompressedBytes) in favor of tracking the total amount of bytes
which has been read() by the user of QDecompressHelper (totalBytesRead),
since we can more intuitively work out the total amount of unread bytes
using this value.

Change-Id: Ie3d8d6e39a18343fcf9b610f45c7fe7e4cd4e474
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-08-04 19:31:52 +02:00
Markus Goetz
85cfbae1d6 QNAM: Allow to configure when connections to a host are torn down
This introduces a new attribute that allows behavior to keep
the TCP connection(s) to a HTTP1/HTTP2 host longer or shorter
than the default of 120 seconds.
Note that the server might still close the connection earlier.

Fixes: QTBUG-20726
Fixes: QTBUG-91440
Change-Id: I7da64230a78c642c12c0ddbe6b678cf17c3aafde
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-27 17:16:58 +02:00
Alex Trotsenko
f18d8fd1fb QLocalSocket/Win: do not close the device on disconnectFromServer()
It's the user's privilege to do so when they want to finish reading the
QIODevice. Moreover, this is the only difference between close() and
disconnectFromServer().

[ChangeLog][QtNetwork][Important Behavior Changes] The Windows
implementation of QLocalSocket::disconnectFromServer() no longer calls
close(), which is consistent with the behavior on Unix.

Change-Id: Ie9ce20c60259a2b08f5254b719355bd7be9b17cd
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
2021-07-24 21:46:44 +03:00
Markus Goetz
e1b010ff47 QNetworkReply: Add two new signals
These signals allow monitoring where in the HTTP1/HTTP2
flow a request is currently in.

Fixes: QTBUG-71698
Fixes: QTBUG-18766
Change-Id: Icc2fe435afc9f680fa7a76c32731e25fcdfeb4b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-20 22:08:39 +02:00
Mårten Nordheim
d9f80502f6 QNetworkDiskCache: Fix tracking of size during storeItem()
If the file already existed we simply removed the old one without
adjusting the size. So use the removeFile() function which takes care of
that.

Additionally, if the current size was non-null we previously increased
the size (presumably meant to be temporarily but wasn't) and called
expire() which would either:
1. not do anything and return currentCacheSize, if it was not greater
than the max size. This would mean that the size of the file would be
counted twice.
or,
2. discard currentCacheSize, measure the size of the items, and then
remove some items if the total size surpassed the max cache size

Neither of those branches need us to (temporarily) increase
currentCacheSize. It also doesn't attain the (presumed) goal of trying
to keep below the max cache size after having added the new item.

Fixes: QTBUG-95009
Pick-to: 6.2 6.1 5.15
Change-Id: I2b5b13ff473a7aa8169cf2aecfea783c97f2d09a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-07-20 18:30:44 +02:00
Timur Pocheptsov
c23b788634 H2: emit encrypted for at least the first reply, similar to H1
Pick-to: 6.2 6.1 5.15
Fixes: QTBUG-95277
Change-Id: I1fe01503376c0d6278e366d7bd31b412b7cc3a69
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-07-20 18:30:44 +02:00
Mårten Nordheim
d33040548f QNetworkRequest: Rename (set)minimumArchiveBombSize
To (set)decompressedSafetyCheckThreshold, as suggested on the API review.

Task-number: QTBUG-94407
Change-Id: Iffc52691022939ae46703de8a0416355487b716f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-07-02 13:05:32 +00:00
Timur Pocheptsov
13ce568b76 tst_http2: use the supportedFeatures() instead of macros
With the recent change, 'system' headers gone: not in the test code anymore,
so, for example OPENSSL_VERSION_NUMBER is undefined, making the test
to select a wrong code-path - 'h2c', instead of encrypted h2.

Pick-to: 6.2
Pick-to: 6.1
Change-Id: I3b201e21fac56875c9045c7463e2ae69af4c6470
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-24 21:35:58 +02:00
Volker Hilsheimer
85121af2eb Fix compiler warning from unused parameter
Change-Id: I227b7188eddbad024dcced908c894925cee56591
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-23 15:06:33 +02:00
Edward Welbourne
accdfbb396 Prefer QFAIL("Informative message") over QVERIFY(false)
Change-Id: I706b0aedfa870452331a8c2c488d55b279ee452a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-06-14 15:57:16 +02:00
Mårten Nordheim
6f25051536 QNetworkReply: Decompress when reading
Rather than when the data is received. Source compatibility is
achieved through double-decompressing the data. This lets us know
how many bytes are available just as before but without having the
uncompressed data left in memory.

Fixes: QTBUG-83269
Change-Id: I352bd09581614c582e4628243e2a0e895ba4946b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-06-12 00:04:04 +02:00
Timur Pocheptsov
096b186004 tst_QNetworkReply::ignoreSslErrorsList, use the right error
The error that the actual runtime will encounter, and not the one that compile-time
ifdefs will (potentially) erroneously select.

Change-Id: I8ef4c34bcb8b3e568bc39f8c8ea6bfb7732f9e27
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-06-08 16:17:23 +02:00
Mårten Nordheim
69982182a3 QNetworkRequest: Add API to set a minimum archive bomb size
Fixes: QTBUG-91870
Change-Id: Ia23e8b8bcfdf65a91fe57e739242a355c681c9e6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-31 17:25:20 +02:00
Timur Pocheptsov
810e755c18 Fix auto-tests that are fooled by the presence of more than one plugin
It's possible that Qt is built with OpenSSL and some other backend.
The ifdefs generated are not mutually exclusive anymore, as it was
in the past. So tests should rely on the actual backend they have
working at runtime.

In the process of fixing the auto-tests, modernized feature #if-ery and
some associated compilation issues.

Fixes: QTBUG-92875
Change-Id: I2be1b924d506fd36dc4e2c6c9158b5023ff87f32
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-05-27 06:41:26 +02:00
Mårten Nordheim
4da22d6534 tst_QDecompressHelper: Move pointer size check inside the test
For some reason the test case was (no longer?) detected by moc

Change-Id: I20f20de76479f7d9db43fae985cefe0869a7e203
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-05-21 21:13:47 +02:00
Joerg Bornemann
92185d417d Fix BASE argument of qt_add_resources
The BASE argument of qt_add_resources now denotes the root point of the
alias of the file.  Before, BASE was merely prepended to every file that
got passed to qt_add_resources.

Old behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "images/button.png")

Alias is "../shared/images/button.png", and pro2cmake generated
QT_RESOURCE_ALIAS assignments to fix this.

New behavior:
    qt_add_resources(app "images"
        PREFIX "/"
        BASE "../shared"
        FILES "../shared/images/button.png")

The alias is "images/button.png".  No extra QT_RESOURCE_ALIAS assignment
is needed.

The new behavior is in effect for user projects and for Qt repositories
that define QT_USE_FIXED_QT_ADD_RESOURCE_BASE.  Qt repositories will be
ported one by one to this new behavior.  Then the old code path can be
removed.

Pick-to: 6.1
Task-number: QTBUG-86726
Change-Id: Ib895edd4df8e97b54badadd9a1c34408beff131f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-18 16:02:52 +02:00
Allan Sandfeld Jensen
e381977b21 Blacklist tst_qnetworkreply::ioHttpRedirectMultipartPost on Linux
Already blacklisted on the other linux versions, but is failing on
SLES now in 5.15

Pick-to: 6.1 5.15
Change-Id: I267908adf94ede51e5520aa2cb806b394fb0438e
Reviewed-by: Tarja Sundqvist <tarja.sundqvist@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-05-12 14:49:45 +02:00
Tor Arne Vestbø
0fb77f80b8 Blacklist and skip failing tests on macOS ARM
Task-number: QTQAINFRA-4431
Change-Id: I4ae47bb461634d524995077501b54322f6beccf3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2021-05-04 22:58:59 +02:00
Mårten Nordheim
deda40b859 Let the h2 test server both send and receive DATA frames
And use this in the authenticationRequired test.

Pick-to: 6.1 6.0 5.15
Change-Id: I18e991eb67168214c2c4f829afaca5018568e989
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-30 14:43:24 +02:00
Mårten Nordheim
52a0eb4791 HTTP/2 authentication required
With Qt 6 we made HTTP/2 default, which exposed missing handling of
401 Unauthorized (and 407 Proxy Authentication Required).

In HTTP/1.* we would handle this after the response had finished, while
handling the status code. For h2 this path isn't used since it is
heavily reliant on the structure we have for HTTP/1.* (one request per
channel). So we must handle the status code and header directly.

Having that part fixed exposed another issue - when resetting/rewinding
uploaded data we were not resetting the 'totallyUploadedData' counter in
the reply (this, in turn, exposed another small issue). Because of that
we did not actually send any data on the retry, only sending the
content-length followed by no data.

Finally, the small issue mentioned in the previous paragraph was how we
check if we have uploaded all our data. It was only checking if the
byte-device was atEnd(), which it was. But only because it had not yet
prepared any data for us.

Fixes: QTBUG-91284
Pick-to: 6.1 6.0 5.15
Change-Id: I798d105b02688b18a02897cc476f19f57a47f98f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-04-29 13:05:16 +02:00
Volker Hilsheimer
3f98ff474f Fix linking on Windows when SSL is not configured
The qt_ForceTlsSecurityLevel symbol is not defined if SSL is not configured,
so don't use it in the QNetworkReply test if it's not.

Change-Id: Id3110a1997fea1648b48bfc411e90e7efe306678
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2021-04-26 14:44:51 +02:00
Timur Pocheptsov
d385158d52 Move plugin code from QtNetwork to qtbase/plugins
All TLS (and non-TLS) backends that QSsl classes rely
on are now in plugins/tls (as openssl, securetransport,
schannel and certonly plugins).

For now, I have to disable some tests that were using OpenSSL
calls - this to be refactored/re-thought. These include:
qsslsocket auto-test (test-case where we work with private keys),
qsslkey auto-test (similar to qsslsocket - test-case working with
keys using OpenSSL calls).
qasn1element moved to plugins too, so its auto-test have to
be re-thought.
Since now we can have more than one working TLS-backend on a given
platform, the presence of OpenSSL also means I force this backend
as active before running tests, to make sure features implemented
only in OpenSSL-backend are tested.
OCSP auto test is disabled for now, since it heavily relies on
OpenSSL symbols (to be refactored).

[ChangeLog][QtNetwork][QSslSocket] QSslSocket by default prefers 'openssl' backend
if it is available.

[ChangeLog][QtNetwork][QSslSocket] TLS-backends are not mutually exclusive anymore,
depending on a platform, more than one TLS backend can be built. E.g., configuring
Qt with -openssl does not prevent SecureTransport or Schannel plugin from being
built.

Fixes: QTBUG-91928
Change-Id: I4c05e32f10179066bee3a518bdfdd6c4b15320c3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2021-04-22 22:51:54 +02:00