diff options
author | Ron Yorston <rmy@pobox.com> | 2018-11-28 10:28:18 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-11-28 10:28:18 +0000 |
commit | 2a69a2200a141c1504b662eca64b802cdab71b12 (patch) | |
tree | eab0cc01852db237a26052a83c8f582ed92b7cd9 /networking/wget.c | |
parent | 97ca1f4b955f486cd26461cb09185335483d2921 (diff) | |
parent | 572dfb8e78323b9837f7c5e3369ee233a440b8f2 (diff) | |
download | busybox-w32-2a69a2200a141c1504b662eca64b802cdab71b12.tar.gz busybox-w32-2a69a2200a141c1504b662eca64b802cdab71b12.tar.bz2 busybox-w32-2a69a2200a141c1504b662eca64b802cdab71b12.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'networking/wget.c')
-rw-r--r-- | networking/wget.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/networking/wget.c b/networking/wget.c index bd2f4edcf..ae5c945d0 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -233,20 +233,19 @@ struct globals { | |||
233 | char *fname_out; /* where to direct output (-O) */ | 233 | char *fname_out; /* where to direct output (-O) */ |
234 | const char *proxy_flag; /* Use proxies if env vars are set */ | 234 | const char *proxy_flag; /* Use proxies if env vars are set */ |
235 | const char *user_agent; /* "User-Agent" header field */ | 235 | const char *user_agent; /* "User-Agent" header field */ |
236 | int output_fd; | ||
237 | int o_flags; | ||
236 | #if ENABLE_FEATURE_WGET_TIMEOUT | 238 | #if ENABLE_FEATURE_WGET_TIMEOUT |
237 | unsigned timeout_seconds; | 239 | unsigned timeout_seconds; |
238 | bool die_if_timed_out; | 240 | smallint die_if_timed_out; |
239 | #endif | 241 | #endif |
240 | int output_fd; | ||
241 | int o_flags; | ||
242 | smallint chunked; /* chunked transfer encoding */ | 242 | smallint chunked; /* chunked transfer encoding */ |
243 | smallint got_clen; /* got content-length: from server */ | 243 | smallint got_clen; /* got content-length: from server */ |
244 | /* Local downloads do benefit from big buffer. | 244 | /* Local downloads do benefit from big buffer. |
245 | * With 512 byte buffer, it was measured to be | 245 | * With 512 byte buffer, it was measured to be |
246 | * an order of magnitude slower than with big one. | 246 | * an order of magnitude slower than with big one. |
247 | */ | 247 | */ |
248 | uint64_t just_to_align_next_member; | 248 | char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(sizeof(long)); |
249 | char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024]; | ||
250 | } FIX_ALIASING; | 249 | } FIX_ALIASING; |
251 | #define G (*ptr_to_globals) | 250 | #define G (*ptr_to_globals) |
252 | #define INIT_G() do { \ | 251 | #define INIT_G() do { \ |
@@ -283,13 +282,15 @@ enum { | |||
283 | #if ENABLE_FEATURE_WGET_STATUSBAR | 282 | #if ENABLE_FEATURE_WGET_STATUSBAR |
284 | static void progress_meter(int flag) | 283 | static void progress_meter(int flag) |
285 | { | 284 | { |
285 | int notty; | ||
286 | |||
286 | if (option_mask32 & WGET_OPT_QUIET) | 287 | if (option_mask32 & WGET_OPT_QUIET) |
287 | return; | 288 | return; |
288 | 289 | ||
289 | if (flag == PROGRESS_START) | 290 | if (flag == PROGRESS_START) |
290 | bb_progress_init(&G.pmt, G.curfile); | 291 | bb_progress_init(&G.pmt, G.curfile); |
291 | 292 | ||
292 | bb_progress_update(&G.pmt, | 293 | notty = bb_progress_update(&G.pmt, |
293 | G.beg_range, | 294 | G.beg_range, |
294 | G.transferred, | 295 | G.transferred, |
295 | (G.chunked || !G.got_clen) ? 0 : G.beg_range + G.transferred + G.content_len | 296 | (G.chunked || !G.got_clen) ? 0 : G.beg_range + G.transferred + G.content_len |
@@ -297,7 +298,8 @@ static void progress_meter(int flag) | |||
297 | 298 | ||
298 | if (flag == PROGRESS_END) { | 299 | if (flag == PROGRESS_END) { |
299 | bb_progress_free(&G.pmt); | 300 | bb_progress_free(&G.pmt); |
300 | bb_putchar_stderr('\n'); | 301 | if (notty == 0) |
302 | bb_putchar_stderr('\n'); /* it's tty */ | ||
301 | G.transferred = 0; | 303 | G.transferred = 0; |
302 | } | 304 | } |
303 | } | 305 | } |
@@ -346,9 +348,8 @@ static void strip_ipv6_scope_id(char *host) | |||
346 | /* Base64-encode character string. */ | 348 | /* Base64-encode character string. */ |
347 | static char *base64enc(const char *str) | 349 | static char *base64enc(const char *str) |
348 | { | 350 | { |
349 | unsigned len = strlen(str); | 351 | /* paranoia */ |
350 | if (len > sizeof(G.wget_buf)/4*3 - 10) /* paranoia */ | 352 | unsigned len = strnlen(str, sizeof(G.wget_buf)/4*3 - 10); |
351 | len = sizeof(G.wget_buf)/4*3 - 10; | ||
352 | bb_uuencode(G.wget_buf, str, len, bb_uuenc_tbl_base64); | 353 | bb_uuencode(G.wget_buf, str, len, bb_uuenc_tbl_base64); |
353 | return G.wget_buf; | 354 | return G.wget_buf; |
354 | } | 355 | } |
@@ -723,8 +724,10 @@ static void spawn_ssl_client(const char *host, int network_fd, int flags) | |||
723 | int pid; | 724 | int pid; |
724 | char *servername, *p; | 725 | char *servername, *p; |
725 | 726 | ||
726 | if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) | 727 | if (!(option_mask32 & WGET_OPT_NO_CHECK_CERT)) { |
728 | option_mask32 |= WGET_OPT_NO_CHECK_CERT; | ||
727 | bb_error_msg("note: TLS certificate validation not implemented"); | 729 | bb_error_msg("note: TLS certificate validation not implemented"); |
730 | } | ||
728 | 731 | ||
729 | servername = xstrdup(host); | 732 | servername = xstrdup(host); |
730 | p = strrchr(servername, ':'); | 733 | p = strrchr(servername, ':'); |