qt6-bb10/tests/auto/network
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
..
access QDecompressHelper: Skip double-decompression if download is small 2021-08-04 19:31:52 +02:00
kernel tests: fix deprecated implicit capture of this via [=] 2021-06-30 23:13:28 +02:00
selftest Remove the qmake project files 2021-01-07 15:32:28 +01:00
socket QLocalSocket: do not emit aboutToClose() twice 2021-08-01 10:50:15 +03:00
ssl testlib: Deprecate QWARN() in favor of qWarning() 2021-08-04 19:31:51 +02:00
CMakeLists.txt CMake: Regenerate subdir test projects 2020-07-09 09:38:39 +02:00