summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2017-03-20 20:04:11 +0200
committerEfraim Flashner <efraim@flashner.co.il>2017-03-20 20:07:56 +0200
commit80042ae93d80244fff5b8c11e9bcbc164a3320e7 (patch)
tree55e4869f35aa87672413ee6bd559dd78cb8ebc2a /gnu/packages
parentf67337e23ec16b1e05fcdcc7953f68f13ed6770a (diff)
downloadguix-80042ae93d80244fff5b8c11e9bcbc164a3320e7.tar.gz
gnu: wget: Fix test-504 failures.
* gnu/packages/wget.scm (wget)[source]: Add patch.
* gnu/packages/patches/wget-fix-504-test-timeout.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/patches/wget-fix-504-test-timeout.patch160
-rw-r--r--gnu/packages/wget.scm5
2 files changed, 163 insertions, 2 deletions
diff --git a/gnu/packages/patches/wget-fix-504-test-timeout.patch b/gnu/packages/patches/wget-fix-504-test-timeout.patch
new file mode 100644
index 0000000000..d9bf154103
--- /dev/null
+++ b/gnu/packages/patches/wget-fix-504-test-timeout.patch
@@ -0,0 +1,160 @@
+This patch is from upstream. If a machine is too slow it can cause
+test-504.py to fail.
+http://git.savannah.gnu.org/cgit/wget.git/patch/?id=ac4fed32204e9ec1874e7cb5ecc55f1b35c1c8de
+
+From ac4fed32204e9ec1874e7cb5ecc55f1b35c1c8de Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Tim=20R=C3=BChsen?= <tim.ruehsen@gmx.de>
+Date: Tue, 14 Feb 2017 16:20:26 +0100
+Subject: Fix 504 status handling
+
+* src/http.c (gethttp): Move 504 handling to correct place.
+  (http_loop): Fix memeory leak.
+* testenv/server/http/http_server.py: Add Content-Length header on non-2xx
+  status codes with a body
+
+Reported-by: Adam Sampson
+---
+ src/http.c                         | 30 +++++++++++-------------------
+ testenv/server/http/http_server.py |  9 +++++----
+ 2 files changed, 16 insertions(+), 23 deletions(-)
+
+diff --git a/src/http.c b/src/http.c
+index 898e184..d2c5c77 100644
+--- a/src/http.c
++++ b/src/http.c
+@@ -3476,7 +3476,7 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
+ 
+ #ifdef HAVE_METALINK
+   /* We need to check for the Metalink data in the very first response
+-     we get from the server (before redirectionrs, authorization, etc.).  */
++     we get from the server (before redirections, authorization, etc.).  */
+   if (metalink)
+     {
+       hs->metalink = metalink_from_http (resp, hs, u);
+@@ -3496,7 +3496,7 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
+       uerr_t auth_err = RETROK;
+       bool retry;
+       /* Normally we are not interested in the response body.
+-         But if we are writing a WARC file we are: we like to keep everyting.  */
++         But if we are writing a WARC file we are: we like to keep everything.  */
+       if (warc_enabled)
+         {
+           int _err;
+@@ -3556,20 +3556,6 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
+         pconn.authorized = true;
+     }
+ 
+-  if (statcode == HTTP_STATUS_GATEWAY_TIMEOUT)
+-    {
+-      hs->len = 0;
+-      hs->res = 0;
+-      hs->restval = 0;
+-
+-      CLOSE_FINISH (sock);
+-      xfree (hs->message);
+-
+-      retval = GATEWAYTIMEOUT;
+-      goto cleanup;
+-    }
+-
+-
+   {
+     uerr_t ret = check_file_output (u, hs, resp, hdrval, sizeof hdrval);
+     if (ret != RETROK)
+@@ -3910,8 +3896,8 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
+               retval = _err;
+               goto cleanup;
+             }
+-          else
+-            CLOSE_FINISH (sock);
++
++          CLOSE_FINISH (sock);
+         }
+       else
+         {
+@@ -3934,7 +3920,11 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs,
+             CLOSE_INVALIDATE (sock);
+         }
+ 
+-      retval = RETRFINISHED;
++      if (statcode == HTTP_STATUS_GATEWAY_TIMEOUT)
++        retval = GATEWAYTIMEOUT;
++      else
++        retval = RETRFINISHED;
++
+       goto cleanup;
+     }
+ 
+@@ -4208,6 +4198,8 @@ http_loop (const struct url *u, struct url *original_url, char **newloc,
+              bring them to "while" statement at the end, to judge
+              whether the number of tries was exceeded.  */
+           printwhat (count, opt.ntry);
++          xfree (hstat.message);
++          xfree (hstat.error);
+           continue;
+         case FWRITEERR: case FOPENERR:
+           /* Another fatal error.  */
+diff --git a/testenv/server/http/http_server.py b/testenv/server/http/http_server.py
+index e96f6e8..b222df0 100644
+--- a/testenv/server/http/http_server.py
++++ b/testenv/server/http/http_server.py
+@@ -204,7 +204,6 @@ class _Handler(BaseHTTPRequestHandler):
+ 
+     def Response(self, resp_obj):
+         self.send_response(resp_obj.response_code)
+-        self.finish_headers()
+         if resp_obj.response_code == 304:
+             raise NoBodyServerError("Conditional get falling to head")
+         raise ServerError("Custom Response code sent.")
+@@ -329,7 +328,6 @@ class _Handler(BaseHTTPRequestHandler):
+         except AuthError as se:
+             self.send_response(401, "Authorization Required")
+             self.send_challenge(auth_rule.auth_type, auth_rule.auth_parm)
+-            self.finish_headers()
+             raise se
+ 
+     def handle_auth(self, auth_rule):
+@@ -362,7 +360,6 @@ class _Handler(BaseHTTPRequestHandler):
+             if header_recd is None or header_recd != exp_headers[header_line]:
+                 self.send_error(400, "Expected Header %s not found" %
+                                 header_line)
+-                self.finish_headers()
+                 raise ServerError("Header " + header_line + " not found")
+ 
+     def RejectHeader(self, header_obj):
+@@ -372,7 +369,6 @@ class _Handler(BaseHTTPRequestHandler):
+             if header_recd and header_recd == rej_headers[header_line]:
+                 self.send_error(400, 'Blacklisted Header %s received' %
+                                 header_line)
+-                self.finish_headers()
+                 raise ServerError("Header " + header_line + ' received')
+ 
+     def __log_request(self, method):
+@@ -400,6 +396,7 @@ class _Handler(BaseHTTPRequestHandler):
+ 
+             content = self.server.fileSys.get(path)
+             content_length = len(content)
++
+             for rule_name in self.rules:
+                 try:
+                     assert hasattr(self, rule_name)
+@@ -410,12 +407,16 @@ class _Handler(BaseHTTPRequestHandler):
+                     return(None, None)
+                 except AuthError as ae:
+                     print(ae.__str__())
++                    self.finish_headers()
+                     return(None, None)
+                 except NoBodyServerError as nbse:
+                     print(nbse.__str__())
++                    self.finish_headers()
+                     return(None, None)
+                 except ServerError as se:
+                     print(se.__str__())
++                    self.add_header("Content-Length", content_length)
++                    self.finish_headers()
+                     return(content, None)
+ 
+             try:
+-- 
+cgit v1.0-41-gc330
+
diff --git a/gnu/packages/wget.scm b/gnu/packages/wget.scm
index 1c56e14a66..a73c68004d 100644
--- a/gnu/packages/wget.scm
+++ b/gnu/packages/wget.scm
@@ -1,7 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
-;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,7 +40,8 @@
       (method url-fetch)
       (uri (string-append "mirror://gnu/wget/wget-"
                           version ".tar.xz"))
-      (patches (search-patches "wget-CVE-2017-6508.patch"))
+      (patches (search-patches "wget-CVE-2017-6508.patch"
+                               "wget-fix-504-test-timeout.patch"))
       (sha256
        (base32
         "1ljcfhbkdsd0zjfm520rbl1ai62fc34i7c45sfj244l8f6b0p58c"))))