mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 09:43:07 -07:00
Fix reply data can't be decompressed correctly
If the "Accept-Encoding" is not manually specified, it will be automatically set to the supported encodings by QT and the reply data will also be automatically decompressed in this case. Setting "Accept-Encoding" manually will disable the "autodecompress" feature before QT 6.3.0. Although QT 6.3.x has different behaviors, let QT specify the "Accept-Encoding" and we will always obtain the decompressed data. The macro "QT_NO_COMPRESS" defined when QT is compiled will disable the zlib support. We can manually address this exceptions. PR #17438.
This commit is contained in:
parent
2071ec0c96
commit
b98e7cb69f
2 changed files with 9 additions and 5 deletions
|
@ -37,7 +37,7 @@
|
|||
#include "base/utils/io.h"
|
||||
#include "base/utils/misc.h"
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 3, 0))
|
||||
#ifdef QT_NO_COMPRESS
|
||||
#include "base/utils/gzip.h"
|
||||
#endif
|
||||
|
||||
|
@ -124,12 +124,12 @@ void DownloadHandlerImpl::processFinishedDownload()
|
|||
}
|
||||
|
||||
// Success
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 3, 0))
|
||||
m_result.data = m_reply->readAll();
|
||||
#else
|
||||
#ifdef QT_NO_COMPRESS
|
||||
m_result.data = (m_reply->rawHeader("Content-Encoding") == "gzip")
|
||||
? Utils::Gzip::decompress(m_reply->readAll())
|
||||
: m_reply->readAll();
|
||||
#else
|
||||
m_result.data = m_reply->readAll();
|
||||
#endif
|
||||
|
||||
if (m_downloadRequest.saveToFile())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue