qt5base-lts/tests/auto/network/access/qdecompresshelper
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
..
4G.br QDecompressHelper: Add brotli support 2020-08-06 20:56:42 +02:00
10K.gz Make qdecompresshelper archive bomb check only trigger for large files 2021-03-05 15:13:53 +01:00
BLACKLIST Blacklist and skip failing tests on macOS ARM 2021-05-04 22:58:59 +02:00
CMakeLists.txt CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
gzip.rcc.cpp Privately introducing QDecompressHelper for network purposes 2020-08-05 09:17:11 +02:00
inflate.rcc.cpp Privately introducing QDecompressHelper for network purposes 2020-08-05 09:17:11 +02:00
tst_qdecompresshelper.cpp QDecompressHelper: Skip double-decompression if download is small 2021-08-04 19:31:52 +02:00
zstandard.rcc.cpp QDecompressHelper: Introduce zstd support 2020-08-14 13:17:11 +02:00