gzipped
gzipped copied to clipboard
Please support Transfer-Encoding: gzip, too
curl has an option:
--tr-encoding
(HTTP) Request a compressed Transfer-Encoding response using one of the algorithms curl supports, and uncompress the data while receiving it.
Using it results in a TE header and the Connection header set to TE.
% curl -v --tr-encoding http://localhost/pkg/nano-amd64-4.9.2-5.squashfs | hexdump -C | head
> GET /pkg/nano-amd64-4.9.2-5.squashfs HTTP/1.1
> Host: localhost
> User-Agent: curl/7.69.0
> Accept: */*
> Connection: TE
> TE: gzip
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Length: 2375680
< Content-Type: application/octet-stream
< Last-Modified: Mon, 11 May 2020 08:33:31 GMT
< Date: Fri, 15 May 2020 17:16:25 GMT
[uncompressed file contents]
If I understand the answers at https://stackoverflow.com/questions/11641923/transfer-encoding-gzip-vs-content-encoding-gzip?rq=1 correctly, transfer-encoding is the better header to use for opting into compression (because it does not mess with proxies), but also the more rarely used one.
It would be great if this package would not only support Accept-Encoding, but also Transfer-Encoding, so that curl users can opt into compression.
Note that you can set accept-encoding using curl.