curl 详解
--compressed
--compressed
(HTTP) Request a compressed response using one of the algorithms
curl supports, and save the uncompressed document. If this
option is used and the server sends an unsupported encoding,
curl will report an error.
- 不指定 header 头,请求返回的结果没有经过压缩
curl -v -o /tmp/ps.js http://e.test.com/assets/vendor/pf/p.js
- 保存 /tmp/ps.js 是被gzip压缩过的
curl -v -o /tmp/ps.js http://e.test.com/assets/vendor/pf/p.js -H 'Accept-Encoding: gzip, deflate, sdch'
- 使用 --compressed 将会保存解压后的文档到 /tmp/ps.js
curl -v -o /tmp/ps.js http://e.test.com/assets/vendor/pf/p.js -H 'Accept-Encoding: gzip, deflate, sdch' --compressed
- 使用 --compressed 将会保存解压后的文档到 /tmp/ps.js,请求头中会添加如下设置: Accept-Encoding: deflate, gzip
curl -v -o /tmp/ps.js http://e.test.com/assets/vendor/pf/p.js --compressed