diff options
Diffstat (limited to 'networking/wget.c')
-rw-r--r-- | networking/wget.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/networking/wget.c b/networking/wget.c index 3cae1192c..bb70039f9 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -248,7 +248,7 @@ struct globals { | |||
248 | * With 512 byte buffer, it was measured to be | 248 | * With 512 byte buffer, it was measured to be |
249 | * an order of magnitude slower than with big one. | 249 | * an order of magnitude slower than with big one. |
250 | */ | 250 | */ |
251 | char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(sizeof(long)); | 251 | char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(16); |
252 | } FIX_ALIASING; | 252 | } FIX_ALIASING; |
253 | #define G (*ptr_to_globals) | 253 | #define G (*ptr_to_globals) |
254 | #define INIT_G() do { \ | 254 | #define INIT_G() do { \ |
@@ -388,9 +388,6 @@ static void set_alarm(void) | |||
388 | * is_ip_address() attempts to verify whether or not a string | 388 | * is_ip_address() attempts to verify whether or not a string |
389 | * contains an IPv4 or IPv6 address (vs. an FQDN). The result | 389 | * contains an IPv4 or IPv6 address (vs. an FQDN). The result |
390 | * of inet_pton() can be used to determine this. | 390 | * of inet_pton() can be used to determine this. |
391 | * | ||
392 | * TODO add proper error checking when inet_pton() returns -1 | ||
393 | * (some form of system error has occurred, and errno is set) | ||
394 | */ | 391 | */ |
395 | static int is_ip_address(const char *string) | 392 | static int is_ip_address(const char *string) |
396 | { | 393 | { |
@@ -908,10 +905,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
908 | polldata.fd = fileno(dfp); | 905 | polldata.fd = fileno(dfp); |
909 | polldata.events = POLLIN | POLLPRI; | 906 | polldata.events = POLLIN | POLLPRI; |
910 | #endif | 907 | #endif |
911 | if (G.output_fd == 1) | 908 | if (!(option_mask32 & WGET_OPT_QUIET)) { |
912 | fprintf(stderr, "writing to stdout\n"); | 909 | if (G.output_fd == 1) |
913 | else | 910 | fprintf(stderr, "writing to stdout\n"); |
914 | fprintf(stderr, "saving to '%s'\n", G.fname_out); | 911 | else |
912 | fprintf(stderr, "saving to '%s'\n", G.fname_out); | ||
913 | } | ||
915 | progress_meter(PROGRESS_START); | 914 | progress_meter(PROGRESS_START); |
916 | 915 | ||
917 | if (G.chunked) | 916 | if (G.chunked) |
@@ -1042,6 +1041,15 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
1042 | */ | 1041 | */ |
1043 | } | 1042 | } |
1044 | 1043 | ||
1044 | /* Draw full bar and free its resources */ | ||
1045 | G.chunked = 0; /* makes it show 100% even for chunked download */ | ||
1046 | G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ | ||
1047 | progress_meter(PROGRESS_END); | ||
1048 | if (G.content_len != 0) { | ||
1049 | bb_perror_msg_and_die("connection closed prematurely"); | ||
1050 | /* GNU wget says "DATE TIME (NN MB/s) - Connection closed at byte NNN. Retrying." */ | ||
1051 | } | ||
1052 | |||
1045 | /* If -c failed, we restart from the beginning, | 1053 | /* If -c failed, we restart from the beginning, |
1046 | * but we do not truncate file then, we do it only now, at the end. | 1054 | * but we do not truncate file then, we do it only now, at the end. |
1047 | * This lets user to ^C if his 99% complete 10 GB file download | 1055 | * This lets user to ^C if his 99% complete 10 GB file download |
@@ -1053,14 +1061,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
1053 | ftruncate(G.output_fd, pos); | 1061 | ftruncate(G.output_fd, pos); |
1054 | } | 1062 | } |
1055 | 1063 | ||
1056 | /* Draw full bar and free its resources */ | 1064 | if (!(option_mask32 & WGET_OPT_QUIET)) { |
1057 | G.chunked = 0; /* makes it show 100% even for chunked download */ | 1065 | if (G.output_fd == 1) |
1058 | G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ | 1066 | fprintf(stderr, "written to stdout\n"); |
1059 | progress_meter(PROGRESS_END); | 1067 | else |
1060 | if (G.output_fd == 1) | 1068 | fprintf(stderr, "'%s' saved\n", G.fname_out); |
1061 | fprintf(stderr, "written to stdout\n"); | 1069 | } |
1062 | else | ||
1063 | fprintf(stderr, "'%s' saved\n", G.fname_out); | ||
1064 | } | 1070 | } |
1065 | 1071 | ||
1066 | static void download_one_url(const char *url) | 1072 | static void download_one_url(const char *url) |
@@ -1421,7 +1427,8 @@ However, in real world it was observed that some web servers | |||
1421 | G.output_fd = -1; | 1427 | G.output_fd = -1; |
1422 | } | 1428 | } |
1423 | } else { | 1429 | } else { |
1424 | fprintf(stderr, "remote file exists\n"); | 1430 | if (!(option_mask32 & WGET_OPT_QUIET)) |
1431 | fprintf(stderr, "remote file exists\n"); | ||
1425 | } | 1432 | } |
1426 | 1433 | ||
1427 | if (dfp != sfp) { | 1434 | if (dfp != sfp) { |
@@ -1492,8 +1499,6 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | |||
1492 | G.proxy_flag = "on"; /* use proxies if env vars are set */ | 1499 | G.proxy_flag = "on"; /* use proxies if env vars are set */ |
1493 | G.user_agent = "Wget"; /* "User-Agent" header field */ | 1500 | G.user_agent = "Wget"; /* "User-Agent" header field */ |
1494 | 1501 | ||
1495 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS | ||
1496 | #endif | ||
1497 | GETOPT32(argv, "^" | 1502 | GETOPT32(argv, "^" |
1498 | "cqSO:o:P:Y:U:T:+" | 1503 | "cqSO:o:P:Y:U:T:+" |
1499 | /*ignored:*/ "t:" | 1504 | /*ignored:*/ "t:" |