aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-08-31 13:28:53 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-08-31 13:28:53 +0200
commit9ff910de6be59eec120158de0b4721701877a9b1 (patch)
treee899080f11e30b218b1c9db05b37ef638fa837e3
parentd811aaa43c20c6f31d8d22c978a06120799dfc70 (diff)
downloadbusybox-w32-9ff910de6be59eec120158de0b4721701877a9b1.tar.gz
busybox-w32-9ff910de6be59eec120158de0b4721701877a9b1.tar.bz2
busybox-w32-9ff910de6be59eec120158de0b4721701877a9b1.zip
wget: treat 201,202,203 as success codes too. Closes 9211
This matches "standard" wget. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/wget.c18
1 files changed, 17 insertions, 1 deletions
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)
1116 while (gethdr(sfp) != NULL) 1116 while (gethdr(sfp) != NULL)
1117 /* eat all remaining headers */; 1117 /* eat all remaining headers */;
1118 goto read_response; 1118 goto read_response;
1119
1120 /* Success responses */
1119 case 200: 1121 case 200:
1122 /* fall through */
1123 case 201: /* 201 Created */
1124/* "The request has been fulfilled and resulted in a new resource being created" */
1125 /* Standard wget is reported to treak this as success */
1126 /* fall through */
1127 case 202: /* 202 Accepted */
1128/* "The request has been accepted for processing, but the processing has not been completed" */
1129 /* Treat as success: fall through */
1130 case 203: /* 203 Non-Authoritative Information */
1131/* "Use of this response code is not required and is only appropriate when the response would otherwise be 200 (OK)" */
1132 /* fall through */
1133 case 204: /* 204 No Content */
1120/* 1134/*
1121Response 204 doesn't say "null file", it says "metadata 1135Response 204 doesn't say "null file", it says "metadata
1122has changed but data didn't": 1136has changed but data didn't":
@@ -1141,7 +1155,6 @@ is always terminated by the first empty line after the header fields."
1141However, in real world it was observed that some web servers 1155However, in real world it was observed that some web servers
1142(e.g. Boa/0.94.14rc21) simply use code 204 when file size is zero. 1156(e.g. Boa/0.94.14rc21) simply use code 204 when file size is zero.
1143*/ 1157*/
1144 case 204:
1145 if (G.beg_range != 0) { 1158 if (G.beg_range != 0) {
1146 /* "Range:..." was not honored by the server. 1159 /* "Range:..." was not honored by the server.
1147 * Restart download from the beginning. 1160 * Restart download from the beginning.
@@ -1149,11 +1162,14 @@ However, in real world it was observed that some web servers
1149 reset_beg_range_to_zero(); 1162 reset_beg_range_to_zero();
1150 } 1163 }
1151 break; 1164 break;
1165 /* 205 Reset Content ?? what to do on this ?? */
1166
1152 case 300: /* redirection */ 1167 case 300: /* redirection */
1153 case 301: 1168 case 301:
1154 case 302: 1169 case 302:
1155 case 303: 1170 case 303:
1156 break; 1171 break;
1172
1157 case 206: /* Partial Content */ 1173 case 206: /* Partial Content */
1158 if (G.beg_range != 0) 1174 if (G.beg_range != 0)
1159 /* "Range:..." worked. Good. */ 1175 /* "Range:..." worked. Good. */