我正在从Helm chart下载https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz。 (事实上它是Redis或者与Helm或其他任何东西有关的事实与这个问题无关,这个问题就像Content-Encoding
等等。)
当我检查它的标题时:
$ curl -H "Accept-Encoding: gzip" -I https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz
...我在输出中看不到Content-Encoding
标头,Content-Type
列为application/x-tar
:
HTTP/1.1 200 OK
X-GUploader-UploadID: AEnB2UqBzSXfTToMAdMARXSjJeN0on3jaNY3u74eXcWfvqsOwRpi38Xc6T0XrrmY4otPeySaYRwXyHccHYtChoPAgFQwYZhQMhcpZRWtZURRANGdfRJoupI
Expires: Tue, 27 Jun 2017 00:21:59 GMT
Date: Mon, 26 Jun 2017 23:21:59 GMT
Cache-Control: public, max-age=3600
Last-Modified: Fri, 05 May 2017 03:03:41 GMT
ETag: "e4184c81a58fb731283847222a1f4005"
x-goog-generation: 1493953421241613
x-goog-metageneration: 1
x-goog-stored-content-encoding: identity
x-goog-stored-content-length: 3550
x-goog-meta-goog-reserved-file-mtime: 1493953414
Content-Type: application/x-tar
x-goog-hash: crc32c=bQHveg==
x-goog-hash: md5=5BhMgaWPtzEoOEciKh9ABQ==
x-goog-storage-class: STANDARD
Accept-Ranges: bytes
Content-Length: 3550
Server: UploadServer
Alt-Svc: quic=":443"; ma=2592000; v="39,38,37,36,35"
下载后生成的文件是一个gzip压缩文件。
以编程方式检测有效负载实际上是gzip的正确方法是什么?或者这是有问题的Web服务器的问题吗?
答案 0 :(得分:0)
我认为服务器配置错误。由于.tgz只是.tar.gz的缩写,因此应该获取内容类型application / gzip -
答案 1 :(得分:0)
Content-Type: application/x-tar
此标题告诉您类型,但我不确定是否是gzip
https://superuser.com/questions/901962/what-is-the-correct-mime-type-for-a-tar-gz-file
看到接受的答案 How to check if a file is gzip compressed?。以编程方式识别