From 108986dce7fbca2e8e9256b3ae0527c7a28df0b13b1ecf1b70a9d2e41254c2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 14 Sep 2017 08:04:20 +0000 Subject: [PATCH 1/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=71 --- wget-416-but-file-not-complete.patch | 17 +++++++++++++++++ wget.spec | 2 ++ 2 files changed, 19 insertions(+) create mode 100644 wget-416-but-file-not-complete.patch diff --git a/wget-416-but-file-not-complete.patch b/wget-416-but-file-not-complete.patch new file mode 100644 index 0000000..bee2ffd --- /dev/null +++ b/wget-416-but-file-not-complete.patch @@ -0,0 +1,17 @@ +Index: wget-1.19.1/src/http.c +=================================================================== +--- wget-1.19.1.orig/src/http.c ++++ wget-1.19.1/src/http.c +@@ -3818,6 +3818,12 @@ gethttp (const struct url *u, struct url + } + } + ++ if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE) ++ { ++ logputs (LOG_VERBOSE, "hs->restval=%s\n", number_to_string(hs->restval)); ++ logputs (LOG_VERBOSE, "contrange=%s\n", number_to_string(contrange)); ++ logputs (LOG_VERBOSE, "contlen=%s\n\n", number_to_string(contlen)); ++ } + if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE + || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK + && contrange == 0 && contlen >= 0 && hs->restval >= contlen)) diff --git a/wget.spec b/wget.spec index a992575..8ae3839 100644 --- a/wget.spec +++ b/wget.spec @@ -34,6 +34,7 @@ Patch6: wget-1.14-no-ssl-comp.patch Patch7: wget-fix-pod-syntax.diff Patch8: wget-errno-clobber.patch Patch9: wget-CVE-2017-6508.patch +Patch10: wget-416-but-file-not-complete.patch BuildRequires: automake BuildRequires: gpgme-devel >= 0.4.2 BuildRequires: libcares-devel @@ -81,6 +82,7 @@ This can be done in script files or via the command line. %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch10 -p1 %build %if 0%{?suse_version} > 1110 From b6d88a66280e4594804447f2d6bd3b98fa38d1cc954b30bc8a71c31cbef896eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 14 Sep 2017 08:08:15 +0000 Subject: [PATCH 2/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=72 --- wget-416-but-file-not-complete.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wget-416-but-file-not-complete.patch b/wget-416-but-file-not-complete.patch index bee2ffd..fff2883 100644 --- a/wget-416-but-file-not-complete.patch +++ b/wget-416-but-file-not-complete.patch @@ -8,9 +8,9 @@ Index: wget-1.19.1/src/http.c + if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE) + { -+ logputs (LOG_VERBOSE, "hs->restval=%s\n", number_to_string(hs->restval)); -+ logputs (LOG_VERBOSE, "contrange=%s\n", number_to_string(contrange)); -+ logputs (LOG_VERBOSE, "contlen=%s\n\n", number_to_string(contlen)); ++ logputs (LOG_VERBOSE, "hs->restval=%s\n", number_to_static_string(hs->restval)); ++ logputs (LOG_VERBOSE, "contrange=%s\n", number_to_static_string(contrange)); ++ logputs (LOG_VERBOSE, "contlen=%s\n\n", number_to_static_string(contlen)); + } if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK From af94813d62d071506c161ef9f7642ccfa0d66e68020d23620324040c193ae3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 14 Sep 2017 08:16:14 +0000 Subject: [PATCH 3/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=73 --- wget-416-but-file-not-complete.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wget-416-but-file-not-complete.patch b/wget-416-but-file-not-complete.patch index fff2883..7d82867 100644 --- a/wget-416-but-file-not-complete.patch +++ b/wget-416-but-file-not-complete.patch @@ -8,9 +8,9 @@ Index: wget-1.19.1/src/http.c + if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE) + { -+ logputs (LOG_VERBOSE, "hs->restval=%s\n", number_to_static_string(hs->restval)); -+ logputs (LOG_VERBOSE, "contrange=%s\n", number_to_static_string(contrange)); -+ logputs (LOG_VERBOSE, "contlen=%s\n\n", number_to_static_string(contlen)); ++ logprintf (LOG_VERBOSE, "hs->restval=%s\n", number_to_static_string(hs->restval)); ++ logprintf (LOG_VERBOSE, "contrange=%s\n", number_to_static_string(contrange)); ++ logprintf (LOG_VERBOSE, "contlen=%s\n\n", number_to_static_string(contlen)); + } if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK From bcf5665223c260fe5fc3633abfcd257c931706f5b94ea8b96a0ea42ce9592692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 14 Sep 2017 08:49:19 +0000 Subject: [PATCH 4/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=74 --- wget-416-but-file-not-complete.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wget-416-but-file-not-complete.patch b/wget-416-but-file-not-complete.patch index 7d82867..6df7334 100644 --- a/wget-416-but-file-not-complete.patch +++ b/wget-416-but-file-not-complete.patch @@ -6,11 +6,11 @@ Index: wget-1.19.1/src/http.c } } -+ if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE) ++ // if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE) + { -+ logprintf (LOG_VERBOSE, "hs->restval=%s\n", number_to_static_string(hs->restval)); -+ logprintf (LOG_VERBOSE, "contrange=%s\n", number_to_static_string(contrange)); -+ logprintf (LOG_VERBOSE, "contlen=%s\n\n", number_to_static_string(contlen)); ++ fprintf (stderr, "hs->restval=%s\n", number_to_static_string(hs->restval)); ++ fprintf (stderr, "contrange=%s\n", number_to_static_string(contrange)); ++ fprintf (stderr, "contlen=%s\n\n", number_to_static_string(contlen)); + } if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK From b633fd5dc9a0ecb99f799ac01559685118f4e62fa1a447ed74f9d1de7e8f86a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 14 Sep 2017 09:31:41 +0000 Subject: [PATCH 5/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=75 --- wget-416-but-file-not-complete.patch | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/wget-416-but-file-not-complete.patch b/wget-416-but-file-not-complete.patch index 6df7334..93c8c4b 100644 --- a/wget-416-but-file-not-complete.patch +++ b/wget-416-but-file-not-complete.patch @@ -2,15 +2,22 @@ Index: wget-1.19.1/src/http.c =================================================================== --- wget-1.19.1.orig/src/http.c +++ wget-1.19.1/src/http.c -@@ -3818,6 +3818,12 @@ gethttp (const struct url *u, struct url +@@ -3818,6 +3818,19 @@ gethttp (const struct url *u, struct url } } -+ // if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE) ++ fprintf(stderr, " hs->restval=%s\n", number_to_static_string(hs->restval)); ++ fprintf(stderr, " contlen=%s\n", number_to_static_string(contlen)); ++ fprintf(stderr, " contrange=%s\n", number_to_static_string(contrange)); ++ if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE ++ && hs->restval < (contlen + contrange)) + { -+ fprintf (stderr, "hs->restval=%s\n", number_to_static_string(hs->restval)); -+ fprintf (stderr, "contrange=%s\n", number_to_static_string(contrange)); -+ fprintf (stderr, "contlen=%s\n\n", number_to_static_string(contlen)); ++ /* The file was not completely downloaded, ++ yet the server claims the range is invalid. ++ Bail out. */ ++ CLOSE_INVALIDATE (sock); ++ retval = RANGEERR; ++ goto cleanup; + } if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK From b25a5037cb2067ee6176c4176d20374c4faee8f79170e469c0278a8190ee7c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 14 Sep 2017 10:11:48 +0000 Subject: [PATCH 6/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=76 --- wget-416-but-file-not-complete.patch | 11 ++++------- wget.changes | 8 ++++++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/wget-416-but-file-not-complete.patch b/wget-416-but-file-not-complete.patch index 93c8c4b..63bec7c 100644 --- a/wget-416-but-file-not-complete.patch +++ b/wget-416-but-file-not-complete.patch @@ -2,14 +2,10 @@ Index: wget-1.19.1/src/http.c =================================================================== --- wget-1.19.1.orig/src/http.c +++ wget-1.19.1/src/http.c -@@ -3818,6 +3818,19 @@ gethttp (const struct url *u, struct url - } +@@ -3819,6 +3819,16 @@ gethttp (const struct url *u, struct url } -+ fprintf(stderr, " hs->restval=%s\n", number_to_static_string(hs->restval)); -+ fprintf(stderr, " contlen=%s\n", number_to_static_string(contlen)); -+ fprintf(stderr, " contrange=%s\n", number_to_static_string(contrange)); -+ if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE + if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE + && hs->restval < (contlen + contrange)) + { + /* The file was not completely downloaded, @@ -19,6 +15,7 @@ Index: wget-1.19.1/src/http.c + retval = RANGEERR; + goto cleanup; + } - if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE ++ if (statcode == HTTP_STATUS_RANGE_NOT_SATISFIABLE || (!opt.timestamping && hs->restval > 0 && statcode == HTTP_STATUS_OK && contrange == 0 && contlen >= 0 && hs->restval >= contlen)) + { diff --git a/wget.changes b/wget.changes index b1c5641..ffd61e2 100644 --- a/wget.changes +++ b/wget.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Sep 14 09:58:51 UTC 2017 - josef.moellers@suse.com + +- If a server responds with 416 Requested Range Not Satisfiable + but the file was not downloaded completely, do not + claim that it was. + [boo#1058204, wget-416-but-file-not-complete.patch] + ------------------------------------------------------------------- Tue Mar 7 13:40:10 UTC 2017 - josef.moellers@suse.com From 08bdfaed503e2b51661a2091ac9ee5246e444bcc2f807999f8e1d68e274672e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 21 Sep 2017 06:45:26 +0000 Subject: [PATCH 7/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=77 --- wget.changes | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wget.changes b/wget.changes index ffd61e2..9425d4c 100644 --- a/wget.changes +++ b/wget.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Sep 21 06:45:00 UTC 2017 - josef.moellers@suse.com + +- Retry http GET when server responds with "416 Requested Range + Not Satisfiable" but file is not complete. + [boo#1058204, wget-416-but-file-not-complete.patch] + ------------------------------------------------------------------- Thu Sep 14 09:58:51 UTC 2017 - josef.moellers@suse.com From 4510c76e6333d2bfd24c4b1b129a9666bf6087dda7b3fb0a1586cf362fc27634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20M=C3=B6llers?= Date: Thu, 21 Sep 2017 06:55:25 +0000 Subject: [PATCH 8/8] OBS-URL: https://build.opensuse.org/package/show/network:utilities/wget?expand=0&rev=78 --- wget.changes | 8 -------- 1 file changed, 8 deletions(-) diff --git a/wget.changes b/wget.changes index 9425d4c..5175d3b 100644 --- a/wget.changes +++ b/wget.changes @@ -5,14 +5,6 @@ Thu Sep 21 06:45:00 UTC 2017 - josef.moellers@suse.com Not Satisfiable" but file is not complete. [boo#1058204, wget-416-but-file-not-complete.patch] -------------------------------------------------------------------- -Thu Sep 14 09:58:51 UTC 2017 - josef.moellers@suse.com - -- If a server responds with 416 Requested Range Not Satisfiable - but the file was not downloaded completely, do not - claim that it was. - [boo#1058204, wget-416-but-file-not-complete.patch] - ------------------------------------------------------------------- Tue Mar 7 13:40:10 UTC 2017 - josef.moellers@suse.com