summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2018-01-10 15:45:17 +0100
committerTim Rühsen <tim.ruehsen@gmx.de>2018-01-10 15:46:13 +0100
commit047746eb765d212cbf05afac16f4bd73257d8186 (patch)
tree8dedf5c1591b050651f735a48241ce76d46a9286
parentd8df356d4ba46401181bdeacb207a5f2b731645c (diff)
downloadwget-047746eb765d212cbf05afac16f4bd73257d8186.tar.gz
* src/http.c: Exclude *.gz and *.tgz from decompression
-rw-r--r--src/http.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/http.c b/src/http.c
index e4ff010..2932da2 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
}