QNetworkManager默认是否接受压缩回复? [英] Does QNetworkManager get accept compressed replies by default?

查看:141
本文介绍了QNetworkManager默认是否接受压缩回复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 QNetworkManager 从服务器获取文件,但是我不能弄清楚,如果文件在传输过程中使用标准gzip压缩进行压缩,如果不是如何让它们下载压缩文件。

I am using QNetworkManager to fetch files from a server, however what I cannot figure out is if the files are compressed during the transfer with the standard gzip compression and if not how to get them to download compressed.

我将如何进行检查?

推荐答案

我刚刚添加了快速测试:

I just ran a quick test by adding:

request.setRawHeader("Accept-Encoding", "gzip,deflate");

到QNetworkRequest,数据返回看起来压缩的内容(因为它减小了约20%且无法使用)。

to the QNetworkRequest and the data returns what look compressed (because its ~20% smaller and unusable).

就解压缩而言,QNetworkManager和QNetworkReply似乎并不智能。看起来我必须在返回的QByteArray上实现gzip和/或deflate。

It appears that the QNetworkManager and the QNetworkReply are not intelligent as far as decompression is concerned. It looks like I have to implement a gzip and/or deflate on the returned QByteArray.

这篇关于QNetworkManager默认是否接受压缩回复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆