Qt-QNetworkReply没有显示Content-Length标头

时间:2015-03-30 18:12:41

标签: c++ qt http networking

对于某些下载URL,QNetworkReply对象不包含Content-Length标头,并将File Size返回为-1。我测试了以下网址:

http://download-cf.jetbrains.com/webide/PhpStorm-EAP-141.332.tar.gz

Firefox中Live HTTP Headers显示的标题如下:

HTTP/1.1 200 OK
Content-Type: application/x-tar
Content-Length: 135144452
Connection: keep-alive
Date: Mon, 30 Mar 2015 17:49:03 GMT
Content-Encoding: gzip
x-amz-meta-s3cmd-attrs: uid:572/gname:cds/uname:cds/gid:574/mode:33188/mtime:1427282503/atime:1427282968/md5:a2ccadce9ae0f356e9c11a6d5dd5a4f0/ctime:1427282503
Last-Modified: Wed, 25 Mar 2015 11:36:03 GMT
Etag: "db9a27ca51b84bac23080028b3e267ef-9"
Accept-Ranges: bytes
Server: AmazonS3
Age: 313
X-Cache: Miss from cloudfront
Via: 1.1 f94856caaa8ad33df4ddf975899fadd2.cloudfront.net (CloudFront)
X-Amz-Cf-Id: GFsaZTTMQ5eQ54JOUzBfJmIHL6AolKkXknb2HAcfbCKsbIYgdJng_Q==

当我做以下时:

qDebug()<<reply->rawHeaderList();

输出结果为:

("Content-Type", "Connection", "Date", "Content-Encoding",
"x-amz-meta-s3cmd-attrs", "Last-Modified",
"ETag", "Accept-Ranges", "Server", "Age", "X-Cache",
"Via", "X-Amz-Cf-Id")

显然,缺少Content-Length。那么,他们是否有任何解决方案。

1 个答案:

答案 0 :(得分:1)

我已经记录了相同的错误报告。它可以在以下网址跟踪:

https://bugreports.qt.io/browse/QTBUG-45322