使用 QNetworkAccessManager::get() 时不需要自动内容转换

发布于 2024-10-08 21:51:15 字数 203 浏览 1 评论 0原文

当使用众所周知的 QNetworkAccessManager 类从网站下载 foo.tar.gz 文件时,我在本地目录中获取了该文件,但实际上本地文件 foo.tar.gz 的内容是 foo.tar ! 该文件似乎是下载然后解压缩然后写入 foo.tar.gz

与 foo.zip 相同的下载或任何文件都运行良好...

我怀疑 mime 自动转换,你能帮我吗?

When using the well known QNetworkAccessManager class for download a foo.tar.gz file from a web site, I got this file in my local dir, but in fact the content of the local file foo.tar.gz is foo.tar !
The file seems to be downloaded then unziped then written in foo.tar.gz

The same download with foo.zip or what so ever file works well...

I suspect mime automatic transform, could you help me ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静谧幽蓝 2024-10-15 21:51:15

成立 !!!

由于未知原因,此代码的 linux QT 版本:

 QNetworkRequest request(url);
 QNetworkReply *reply = manager.get(request);

添加对象请求,例如:

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

Mac OSX 和 Windows 没有!当您尝试下载 foo.tar.gz 文件时,Linux 版本会(即时)解压缩本地文件

可能是 Qt4.7.1 的错误?!

found !!!

For an unknown reason the linux QT version of this code :

 QNetworkRequest request(url);
 QNetworkReply *reply = manager.get(request);

add in object request something like :

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

the Mac OSX and Windows does not !! and when you try to download a foo.tar.gz file, the Linux version unzip (on the fly) the local file

May be a Qt4.7.1 bug ?!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文