* With 512 byte buffer, it was measured to be
* an order of magnitude slower than with big one.
*/
- char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(sizeof(long));
+ char wget_buf[CONFIG_FEATURE_COPYBUF_KB*1024] ALIGNED(16);
} FIX_ALIASING;
#define G (*ptr_to_globals)
#define INIT_G() do { \
* is_ip_address() attempts to verify whether or not a string
* contains an IPv4 or IPv6 address (vs. an FQDN). The result
* of inet_pton() can be used to determine this.
- *
- * TODO add proper error checking when inet_pton() returns -1
- * (some form of system error has occurred, and errno is set)
*/
static int is_ip_address(const char *string)
{
*/
}
+ /* Draw full bar and free its resources */
+ G.chunked = 0; /* makes it show 100% even for chunked download */
+ G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
+ progress_meter(PROGRESS_END);
+ if (G.content_len != 0) {
+ bb_perror_msg_and_die("connection closed prematurely");
+ /* GNU wget says "DATE TIME (NN MB/s) - Connection closed at byte NNN. Retrying." */
+ }
+
/* If -c failed, we restart from the beginning,
* but we do not truncate file then, we do it only now, at the end.
* This lets user to ^C if his 99% complete 10 GB file download
ftruncate(G.output_fd, pos);
}
- /* Draw full bar and free its resources */
- G.chunked = 0; /* makes it show 100% even for chunked download */
- G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
- progress_meter(PROGRESS_END);
if (!(option_mask32 & WGET_OPT_QUIET)) {
if (G.output_fd == 1)
fprintf(stderr, "written to stdout\n");