Commit fdfa7d0 1 parent cafd232 commit fdfa7d0 Copy full SHA for fdfa7d0
File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -641,8 +641,20 @@ void PropagateDownloadFile::slotGetFinished()
641
641
*/
642
642
const QByteArray sizeHeader (" Content-Length" );
643
643
quint64 bodySize = job->reply ()->rawHeader (sizeHeader).toULongLong ();
644
+ bool hasSizeHeader = !job->reply ()->rawHeader (sizeHeader).isEmpty ();
644
645
645
- if (!job->reply ()->rawHeader (sizeHeader).isEmpty () && _tmpFile.size () > 0 && bodySize == 0 ) {
646
+ // Qt removes the content-length header for transparently decompressed HTTP1 replies
647
+ // but not for HTTP2 or SPDY replies. For these it remains and contains the size
648
+ // of the compressed data. See QTBUG-73364.
649
+ const auto contentEncoding = job->reply ()->rawHeader (" content-encoding" ).toLower ();
650
+ if ((contentEncoding == " gzip" || contentEncoding == " deflate" )
651
+ && (job->reply ()->attribute (QNetworkRequest::HTTP2WasUsedAttribute).toBool ()
652
+ || job->reply ()->attribute (QNetworkRequest::SpdyWasUsedAttribute).toBool ())) {
653
+ bodySize = 0 ;
654
+ hasSizeHeader = false ;
655
+ }
656
+
657
+ if (hasSizeHeader && _tmpFile.size () > 0 && bodySize == 0 ) {
646
658
// Strange bug with broken webserver or webfirewall https://github.com/owncloud/client/issues/3373#issuecomment-122672322
647
659
// This happened when trying to resume a file. The Content-Range header was files, Content-Length was == 0
648
660
qCDebug (lcPropagateDownload) << bodySize << _item->_size << _tmpFile.size () << job->resumeStart ();
You can’t perform that action at this time.
0 commit comments