记录一下 HTTPS 文件下载遇到的小问题

第一次请求

第一次请求 “https://download.qt.io/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe” 返回的http头信息:

HTTP/1.1 302 Found
Date: Sun, 31 Jul 2022 15:52:39 GMT
Server: Apache
Strict-Transport-Security: max-age=63072000; includeSubdomains;
X-Prefix: ***.***.***.***/15
X-AS: 4134
X-MirrorBrain-Mirror: en.ustc.edu.cn
X-MirrorBrain-Realm: country
Link: <https://download.qt.io/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe.meta4>; rel=describedby; type="application/metalink4+xml"
Link: <https://download.qt.io/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe.torrent>; rel=describedby; type="application/x-bittorrent"
Link: <https://mirrors.ustc.edu.cn/qtproject/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe>; rel=duplicate; pri=1; geo=cn
Link: <https://ftp.jaist.ac.jp/pub/qtproject/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe>; rel=duplicate; pri=2; geo=jp
Link: <https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe>; rel=duplicate; pri=3; geo=jp
Link: <https://master.qt.io/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe>; rel=duplicate; pri=4; geo=fi
Link: <https://www.nic.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe>; rel=duplicate; pri=5; geo=fi
Digest: MD5=B3qYiFYLrOLVb47tmV21jA==
Digest: SHA=zdV/P/bW+4y6BeUYHWoVOg7X80I=
Digest: SHA-256=4oX2Gc/h0QUB/xYK0PC/31I0yAa/0ZqBXhP2GUarhMc=
Location: https://mirrors.ustc.edu.cn/qtproject/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe
Content-Length: 281
Connection: close
Content-Type: text/html; charset=iso-8859-1

第二次请求

第二次请求第一次请求返回的 Location “https://mirrors.ustc.edu.cn/qtproject/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe” 返回的http头信息:

HTTP/1.1 302 Moved Temporarily
Server: openresty
Date: Sun, 31 Jul 2022 15:55:05 GMT
Content-Type: text/html
Content-Length: 142
Connection: close
Location: https://iso.mirrors.ustc.edu.cn/qtproject/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe

问题所在

到这一步服务器已开始下发exe文件数据
第三次请求第二次请求返回的 Location “https://iso.mirrors.ustc.edu.cn/qtproject/archive/qt/5.14/5.14.2/qt-opensource-windows-x86-5.14.2.exe” 返回的http头信息:

HTTP/1.1 200 OK
Server: openresty
Date: Sun, 31 Jul 2022 16:03:42 GMT
// 问题所在: 正常的exe文件 Content-Type 应该是 application/octet-stream, 可是它却返回了 text/html!
Content-Type: text/html; charset=UTF-8
Content-Length: 2448792112
Last-Modified: Tue, 31 Mar 2020 07:18:38 GMT
Connection: close
ETag: "5e82eece-91f59a30"
X-RateLimit-Byte-Rate: 134217728
Accept-Ranges: bytes

你可能感兴趣的:(VC/MFC/C/C++,https,qt,网络协议,文件下载)