Hi,

Thanks for reporting the bug. It indeed seems like an issue there. We really
need tests for this feature.

In any case, here is a slightly amended patch that I intend to push by this
evening if nobody complains. 

* G-Ey3dr <[email protected]> [180120 06:49]:
> Hello all,
> 
> Wget1.19.3 seem to have the bug in decompress. See below.
> 
> diff -aur wget-1.19.3_old/src/http.c wget-1.19.3_new/src/http.c
> --- wget-1.19.3_old/src/http.c    2018-01-14 19:22:42.000000000 +0900
> +++ wget-1.19.3_new/src/http.c    2018-01-20 11:46:15.897109600 +0900
> @@ -3744,7 +3744,7 @@
>            /* 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")))
> +              && (!c_strcasecmp(p, ".gz") || !c_strcasecmp(p, ".tgz")))
>              {
>                 hs->remote_encoding = ENC_NONE;
>              }
> 
> Best regards,
> Reiji

-- 
Thanking You,
Darshit Shah
PGP Fingerprint: 7845 120B 07CB D8D6 ECE5 FF2B 2A17 43ED A91A 35B6
From a7cc4e2b3706c17bd64afec121e0b2515aacaf63 Mon Sep 17 00:00:00 2001
From: Reiji <[email protected]>
Date: Sat, 20 Jan 2018 14:01:37 +0100
Subject: [PATCH] * src/http.c (gethttp): Fix bug that prevented all files from
 being decompressed

Signed-off-by: Darshit Shah <[email protected]>
---
 src/http.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/http.c b/src/http.c
index 1cd2768c..5bbaa52c 100644
--- a/src/http.c
+++ b/src/http.c
@@ -3717,7 +3717,7 @@ gethttp (const struct url *u, struct url *original_url, 
struct http_stat *hs,
           /* Make sure the Content-Type is not gzip before decompressing */
           if (type)
             {
-              const char * p = strchr (type, '/');
+              p = strchr (type, '/');
               if (p == NULL)
                 {
                   hs->remote_encoding = ENC_GZIP;
@@ -3744,8 +3744,9 @@ gethttp (const struct url *u, struct url *original_url, 
struct http_stat *hs,
           /* 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")))
+              && (c_strcasecmp(p, ".gz") == 0 || c_strcasecmp(p, ".tgz") == 0))
             {
+               DEBUGP (("Enabling broken server workaround. Will not 
decompress this GZip file.\n"));
                hs->remote_encoding = ENC_NONE;
             }
         }
-- 
2.16.0

Attachment: signature.asc
Description: PGP signature

Reply via email to