【发布时间】:2019-10-14 16:04:01
【问题描述】:
由于某些原因,即使设置了 Content-Encoding: deflate 标头,CLI 版本的 Curl 也不会解压缩我的页面。浏览器打开文件就好了。 wget 还解压缩输出。我记得它在一段时间前工作过。 Curl 不解压缩压缩流的原因可能是什么?
$curl app.pitchinvestorslive.com/env.js -i
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 401
Content-Type: text/javascript
Cache-Control: max-age=60
Content-Encoding: deflate
Date: Mon, 14 Oct 2019 14:04:17 GMT
Connection: keep-alive
�(��LY[^T����}L�s�hcyn��w͎*)��ӦԢ�L�k�x��l_c���
$ curl --version
curl 7.64.0 (x86_64-pc-linux-gnu) libcurl/7.64.0 OpenSSL/1.1.1b zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.5) libssh/0.8.6/openssl/zlib nghttp2/1.36.0 librtmp/2.3
Release-Date: 2019-02-06
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL
【问题讨论】:
-
Curl 需要
--compressed来自动解压,没有这个header它只会请求未压缩的网页。 -
curl --compressed app.pitchinvestorslive.com/env.js -icmd 工作