summaryrefslogtreecommitdiff
path: root/networking/wget.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/wget.c')
-rw-r--r--networking/wget.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/networking/wget.c b/networking/wget.c
index ad09091d3..d944f0173 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -114,9 +114,8 @@ int wget_main(int argc, char **argv)
114 bool use_proxy = 1; /* Use proxies if env vars are set */ 114 bool use_proxy = 1; /* Use proxies if env vars are set */
115 const char *proxy_flag = "on"; /* Use proxies if env vars are set */ 115 const char *proxy_flag = "on"; /* Use proxies if env vars are set */
116 const char *user_agent = "Wget";/* "User-Agent" header field */ 116 const char *user_agent = "Wget";/* "User-Agent" header field */
117 static const char * const keywords[] = { 117 static const char keywords[] =
118 "content-length", "transfer-encoding", "chunked", "location", NULL 118 "content-length\0""transfer-encoding\0""chunked\0""location\0";
119 };
120 enum { 119 enum {
121 KEY_content_length = 1, KEY_transfer_encoding, KEY_chunked, KEY_location 120 KEY_content_length = 1, KEY_transfer_encoding, KEY_chunked, KEY_location
122 }; 121 };
@@ -143,7 +142,7 @@ int wget_main(int argc, char **argv)
143 "user-agent\0" Required_argument "U" 142 "user-agent\0" Required_argument "U"
144 "passive-ftp\0" No_argument "\xff" 143 "passive-ftp\0" No_argument "\xff"
145 "header\0" Required_argument "\xfe" 144 "header\0" Required_argument "\xfe"
146 "\0"; 145 ;
147 applet_long_options = wget_longopts; 146 applet_long_options = wget_longopts;
148#endif 147#endif
149 /* server.allocated = target.allocated = NULL; */ 148 /* server.allocated = target.allocated = NULL; */
@@ -327,7 +326,7 @@ int wget_main(int argc, char **argv)
327 */ 326 */
328 while ((str = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) { 327 while ((str = gethdr(buf, sizeof(buf), sfp, &n)) != NULL) {
329 /* gethdr did already convert the "FOO:" string to lowercase */ 328 /* gethdr did already convert the "FOO:" string to lowercase */
330 smalluint key = index_in_str_array(keywords, *&buf) + 1; 329 smalluint key = index_in_strings(keywords, *&buf) + 1;
331 if (key == KEY_content_length) { 330 if (key == KEY_content_length) {
332 content_len = BB_STRTOOFF(str, NULL, 10); 331 content_len = BB_STRTOOFF(str, NULL, 10);
333 if (errno || content_len < 0) { 332 if (errno || content_len < 0) {
@@ -337,7 +336,7 @@ int wget_main(int argc, char **argv)
337 continue; 336 continue;
338 } 337 }
339 if (key == KEY_transfer_encoding) { 338 if (key == KEY_transfer_encoding) {
340 if (index_in_str_array(keywords, str_tolower(str)) + 1 != KEY_chunked) 339 if (index_in_strings(keywords, str_tolower(str)) + 1 != KEY_chunked)
341 bb_error_msg_and_die("server wants to do %s transfer encoding", str); 340 bb_error_msg_and_die("server wants to do %s transfer encoding", str);
342 chunked = got_clen = 1; 341 chunked = got_clen = 1;
343 } 342 }