From 9ff910de6be59eec120158de0b4721701877a9b1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 31 Aug 2016 13:28:53 +0200 Subject: [PATCH] wget: treat 201,202,203 as success codes too. Closes 9211 This matches "standard" wget. Signed-off-by: Denys Vlasenko --- networking/wget.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/networking/wget.c b/networking/wget.c index 7a4650585..800ff76a6 100644 --- a/networking/wget.c +++ b/networking/wget.c @@ -1116,7 +1116,21 @@ static void download_one_url(const char *url) while (gethdr(sfp) != NULL) /* eat all remaining headers */; goto read_response; + + /* Success responses */ case 200: + /* fall through */ + case 201: /* 201 Created */ +/* "The request has been fulfilled and resulted in a new resource being created" */ + /* Standard wget is reported to treak this as success */ + /* fall through */ + case 202: /* 202 Accepted */ +/* "The request has been accepted for processing, but the processing has not been completed" */ + /* Treat as success: fall through */ + case 203: /* 203 Non-Authoritative Information */ +/* "Use of this response code is not required and is only appropriate when the response would otherwise be 200 (OK)" */ + /* fall through */ + case 204: /* 204 No Content */ /* Response 204 doesn't say "null file", it says "metadata has changed but data didn't": @@ -1141,7 +1155,6 @@ is always terminated by the first empty line after the header fields." However, in real world it was observed that some web servers (e.g. Boa/0.94.14rc21) simply use code 204 when file size is zero. */ - case 204: if (G.beg_range != 0) { /* "Range:..." was not honored by the server. * Restart download from the beginning. @@ -1149,11 +1162,14 @@ However, in real world it was observed that some web servers reset_beg_range_to_zero(); } break; + /* 205 Reset Content ?? what to do on this ?? */ + case 300: /* redirection */ case 301: case 302: case 303: break; + case 206: /* Partial Content */ if (G.beg_range != 0) /* "Range:..." worked. Good. */ -- 2.25.1