mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06: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:
@@ -123,8 +123,12 @@ namespace
|
||||
|
||||
// Spoof HTTP Referer to allow adding torrent link from Torcache/KickAssTorrents
|
||||
request.setRawHeader("Referer", request.url().toEncoded().data());
|
||||
// Accept gzip
|
||||
#ifdef QT_NO_COMPRESS
|
||||
// The macro "QT_NO_COMPRESS" defined in QT will disable the zlib releated features
|
||||
// and reply data auto-decompression in QT will also be disabled. But we can support
|
||||
// gzip encoding and manually decompress the reply data.
|
||||
request.setRawHeader("Accept-Encoding", "gzip");
|
||||
#endif
|
||||
// Qt doesn't support Magnet protocol so we need to handle redirections manually
|
||||
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user