From 047746eb765d212cbf05afac16f4bd73257d8186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Wed, 10 Jan 2018 15:45:17 +0100 Subject: [PATCH] * src/http.c: Exclude *.gz and *.tgz from decompression --- src/http.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/http.c b/src/http.c index e4ff0107..2932da2e 100644 --- a/src/http.c +++ b/src/http.c @@ -3713,6 +3713,8 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs, else if (hs->local_encoding == ENC_GZIP && opt.compression != compression_none) { + const char *p; + /* Make sure the Content-Type is not gzip before decompressing */ if (type) { @@ -3739,6 +3741,14 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs, hs->remote_encoding = ENC_GZIP; hs->local_encoding = ENC_NONE; } + + /* don't uncompress if a file ends with '.gz' or '.tgz' */ + if (hs->remote_encoding == ENC_GZIP + && (p = strrchr(u->file, '.')) + && (c_strcasecmp(p, ".gz") || c_strcasecmp(p, ".tgz"))) + { + hs->remote_encoding = ENC_NONE; + } } #endif }