diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-05-14 14:12:28 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-05-14 14:12:28 +0200 |
commit | e611879eab9ad99ea6fa1f51529c4c85e679dad2 (patch) | |
tree | d5ce08a694578e01f15f2e215e66f672a9b376e2 | |
parent | 2b4a488762eb85495d0001cfa689f12b2c746a7a (diff) | |
download | plan9front-e611879eab9ad99ea6fa1f51529c4c85e679dad2.tar.xz |
hget: work arround apache Content-Encoding: gzip for Content-Type: application/x-gzip bug
apache sends Content-Encoding: gzip header for Content-Type: application/x-gzip
causing hget to decompress tgz files.
from the w3c:
The Content-Encoding entity-header field is used as a modifier to the media-type.
When presented, its value indicates what additional content codings have been applied
to the entity-body, and thus what decoding mechanisms must be applied in order to
obtail the media-type referenced by the Conent-Type header field. Content-Encoding
is primarily used to allow a document to be compressed without losing the
identity of its underlying media type.
this is clearly silly, as the file is already compressed, and decompressing it
will not yield the indicated Content-type: application/x-gzip, but a tarball.
examples:
http://zlib.net/zlib-1.2.8.tar.gz
https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R50f.tgz
-rwxr-xr-x | rc/bin/hget | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/rc/bin/hget b/rc/bin/hget index 82b9cba67..dca3c1522 100755 --- a/rc/bin/hget +++ b/rc/bin/hget @@ -84,11 +84,11 @@ if(! ~ $s 0) c=`{cat $d/contentencoding >[2]/dev/null} switch($c){ case *gzip* - exec gunzip + ~ `{cat $d/contenttype >[2]/dev/null} *gzip* || exec gunzip case *bzip2* - exec bunzip2 + ~ `{cat $d/contenttype >[2]/dev/null} *bzip2* || exec bunzip2 case *compress* - exec uncompress + ~ `{cat $d/contenttype >[2]/dev/null} *compress* || exec uncompress } exec cat } |