mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03: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
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue