我怎么知道这个URL的内容是gzip-encoded呢?
How can I tell that the content of this URL is gzip-encoded?
我正在下载 Helm chart from https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz。 (它是 Redis 或与 Helm 或任何特别相关的事实与这个问题无关,这只是关于 Content-Encoding
之类的事情。)
当我这样检查它的 header 时:
$ curl -H "Accept-Encoding: gzip" -I https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz
…我在输出中没有看到 Content-Encoding
header,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"
下载后的结果文件是一个 gzipped tar 存档。
以编程方式检测负载实际上是否已 gzip 压缩的正确方法是什么?或者这是相关网络服务器的问题?
我认为服务器配置错误。由于 .tgz 只是 .tar.gz 的缩写,它应该获得内容类型 application/gzip-
Content-Type: application/x-tar
这个 header 告诉你类型,但我不确定那是 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?。以编程方式识别的方法
我正在下载 Helm chart from https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz。 (它是 Redis 或与 Helm 或任何特别相关的事实与这个问题无关,这只是关于 Content-Encoding
之类的事情。)
当我这样检查它的 header 时:
$ curl -H "Accept-Encoding: gzip" -I https://kubernetes-charts.storage.googleapis.com/redis-0.5.1.tgz
…我在输出中没有看到 Content-Encoding
header,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"
下载后的结果文件是一个 gzipped tar 存档。
以编程方式检测负载实际上是否已 gzip 压缩的正确方法是什么?或者这是相关网络服务器的问题?
我认为服务器配置错误。由于 .tgz 只是 .tar.gz 的缩写,它应该获得内容类型 application/gzip-
Content-Type: application/x-tar
这个 header 告诉你类型,但我不确定那是 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?。以编程方式识别的方法