diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-08-31 13:28:53 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-08-31 13:28:53 +0200 |
commit | 9ff910de6be59eec120158de0b4721701877a9b1 (patch) | |
tree | e899080f11e30b218b1c9db05b37ef638fa837e3 | |
parent | d811aaa43c20c6f31d8d22c978a06120799dfc70 (diff) | |
download | busybox-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.c | 18 |
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 | /* |
1121 | Response 204 doesn't say "null file", it says "metadata | 1135 | Response 204 doesn't say "null file", it says "metadata |
1122 | has changed but data didn't": | 1136 | has changed but data didn't": |
@@ -1141,7 +1155,6 @@ is always terminated by the first empty line after the header fields." | |||
1141 | However, in real world it was observed that some web servers | 1155 | However, 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. */ |