X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=src%2Fhttp.c;h=9551fb12170a198232f7340398dd523090095469;hp=cd2bd15eb1574f42584bfb5a64e39cf92bc1351f;hb=8c2fd06ba80b5312b4540859d452664450ec054f;hpb=43c89ab7a5b20a84c0f393cb5393b68d3ce382fe diff --git a/src/http.c b/src/http.c index cd2bd15e..9551fb12 100644 --- a/src/http.c +++ b/src/http.c @@ -1586,7 +1586,7 @@ read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen, /* Download the response body and write it to fp. If we are working on a WARC file, we simultaneously write the response body to warc_tmp. */ - hs->res = fd_read_body (sock, fp, contlen != -1 ? contlen : 0, + hs->res = fd_read_body (hs->local_file, sock, fp, contlen != -1 ? contlen : 0, hs->restval, &hs->rd_size, &hs->len, &hs->dltime, flags, warc_tmp); if (hs->res >= 0) @@ -2618,6 +2618,22 @@ read_header: if (H_20X (statcode)) *dt |= RETROKF; + if (statcode == HTTP_STATUS_NO_CONTENT) + { + /* 204 response has no body (RFC 2616, 4.3) */ + + /* In case the caller cares to look... */ + hs->len = 0; + hs->res = 0; + hs->restval = 0; + + CLOSE_FINISH (sock); + xfree_null (type); + xfree (head); + + return RETRFINISHED; + } + /* Return if redirected. */ if (H_REDIRECTED (statcode) || statcode == HTTP_STATUS_MULTIPLE_CHOICES) { @@ -2945,11 +2961,8 @@ read_header: fp = output_stream; /* Print fetch message, if opt.verbose. */ - if (opt.verbose) - { - logprintf (LOG_NOTQUIET, _("Saving to: %s\n"), + logprintf (LOG_VERBOSE, _("Saving to: %s\n"), HYPHENP (hs->local_file) ? quote ("STDOUT") : quote (hs->local_file)); - } err = read_response_body (hs, sock, fp, contlen, contrange, @@ -3121,6 +3134,8 @@ Spider mode enabled. Check if remote file exists.\n")); /* Decide whether or not to restart. */ if (force_full_retrieve) hstat.restval = hstat.len; + else if (opt.start_pos >= 0) + hstat.restval = opt.start_pos; else if (opt.always_rest && got_name && stat (hstat.local_file, &st) == 0