From 8b5e487bf38b0dcd8d2fc1002e486f418bf52f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim Rühsen?= Date: Tue, 14 Feb 2017 16:20:26 +0100 Subject: [PATCH] Fix 504 status handling --- src/http.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/http.c b/src/http.c index 898e1841..788a29ff 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,6 +3556,7 @@ 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; @@ -3568,7 +3569,7 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs, retval = GATEWAYTIMEOUT; goto cleanup; } - +*/ { uerr_t ret = check_file_output (u, hs, resp, hdrval, sizeof hdrval); @@ -3910,8 +3911,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 +3935,14 @@ gethttp (const struct url *u, struct url *original_url, struct http_stat *hs, CLOSE_INVALIDATE (sock); } - retval = RETRFINISHED; + if (statcode == HTTP_STATUS_GATEWAY_TIMEOUT) + { + /* xfree (hs->message); */ + retval = GATEWAYTIMEOUT; + } + else + retval = RETRFINISHED; + goto cleanup; } -- 2.11.0