mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Don't read more than the amount of data specified by the content-length
header. Removed the obsolete "kill_lines" wgetrc var.
This commit is contained in:
parent
fdb3a03fca
commit
b138e352e0
@ -2664,12 +2664,6 @@ or @samp{-6}.
|
|||||||
@item input = @var{file}
|
@item input = @var{file}
|
||||||
Read the @sc{url}s from @var{string}, like @samp{-i @var{file}}.
|
Read the @sc{url}s from @var{string}, like @samp{-i @var{file}}.
|
||||||
|
|
||||||
@item kill_longer = on/off
|
|
||||||
Consider data longer than specified in content-length header as invalid
|
|
||||||
(and retry getting it). The default behavior is to save as much data
|
|
||||||
as there is, provided there is more than or equal to the value in
|
|
||||||
@code{Content-Length}.
|
|
||||||
|
|
||||||
@item limit_rate = @var{rate}
|
@item limit_rate = @var{rate}
|
||||||
Limit the download speed to no more than @var{rate} bytes per second.
|
Limit the download speed to no more than @var{rate} bytes per second.
|
||||||
The same as @samp{--limit-rate=@var{rate}}.
|
The same as @samp{--limit-rate=@var{rate}}.
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
2005-08-09 Hrvoje Niksic <hniksic@xemacs.org>
|
||||||
|
|
||||||
|
* http.c (gethttp): Don't read more than the amount of data
|
||||||
|
specified by the content-length header.
|
||||||
|
|
||||||
2005-08-09 Vasil Dimov <vd@datamax.bg>
|
2005-08-09 Vasil Dimov <vd@datamax.bg>
|
||||||
|
|
||||||
* ftp.c (getftp): Don't free RESPLINE if ftp_response returns a
|
* ftp.c (getftp): Don't free RESPLINE if ftp_response returns a
|
||||||
|
50
src/http.c
50
src/http.c
@ -1950,7 +1950,10 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy)
|
|||||||
|
|
||||||
/* Download the request body. */
|
/* Download the request body. */
|
||||||
flags = 0;
|
flags = 0;
|
||||||
if (keep_alive)
|
if (contlen != -1)
|
||||||
|
/* If content-length is present, read that much; otherwise, read
|
||||||
|
until EOF. The HTTP spec doesn't require the server to
|
||||||
|
actually close the connection when it's done sending data. */
|
||||||
flags |= rb_read_exactly;
|
flags |= rb_read_exactly;
|
||||||
if (hs->restval > 0 && contrange == 0)
|
if (hs->restval > 0 && contrange == 0)
|
||||||
/* If the server ignored our range request, instruct fd_read_body
|
/* If the server ignored our range request, instruct fd_read_body
|
||||||
@ -2352,9 +2355,7 @@ The sizes do not match (local %s) -- retrieving.\n"),
|
|||||||
if ((tmr != (time_t) (-1))
|
if ((tmr != (time_t) (-1))
|
||||||
&& !opt.spider
|
&& !opt.spider
|
||||||
&& ((hstat.len == hstat.contlen) ||
|
&& ((hstat.len == hstat.contlen) ||
|
||||||
((hstat.res == 0) &&
|
((hstat.res == 0) && (hstat.contlen == -1))))
|
||||||
((hstat.contlen == -1) ||
|
|
||||||
(hstat.len >= hstat.contlen && !opt.kill_longer)))))
|
|
||||||
{
|
{
|
||||||
/* #### This code repeats in http.c and ftp.c. Move it to a
|
/* #### This code repeats in http.c and ftp.c. Move it to a
|
||||||
function! */
|
function! */
|
||||||
@ -2450,43 +2451,10 @@ The sizes do not match (local %s) -- retrieving.\n"),
|
|||||||
free_hstat (&hstat);
|
free_hstat (&hstat);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!opt.kill_longer) /* meaning we got more than expected */
|
else
|
||||||
{
|
/* Getting here would mean reading more data than
|
||||||
logprintf (LOG_VERBOSE,
|
requested with content-length, which we never do. */
|
||||||
_("%s (%s) - `%s' saved [%s/%s]\n\n"),
|
abort ();
|
||||||
tms, tmrate, locf,
|
|
||||||
number_to_static_string (hstat.len),
|
|
||||||
number_to_static_string (hstat.contlen));
|
|
||||||
logprintf (LOG_NONVERBOSE,
|
|
||||||
"%s URL:%s [%s/%s] -> \"%s\" [%d]\n",
|
|
||||||
tms, u->url,
|
|
||||||
number_to_static_string (hstat.len),
|
|
||||||
number_to_static_string (hstat.contlen),
|
|
||||||
locf, count);
|
|
||||||
++opt.numurls;
|
|
||||||
total_downloaded_bytes += hstat.len;
|
|
||||||
|
|
||||||
/* Remember that we downloaded the file for later ".orig" code. */
|
|
||||||
if (*dt & ADDED_HTML_EXTENSION)
|
|
||||||
downloaded_file(FILE_DOWNLOADED_AND_HTML_EXTENSION_ADDED, locf);
|
|
||||||
else
|
|
||||||
downloaded_file(FILE_DOWNLOADED_NORMALLY, locf);
|
|
||||||
|
|
||||||
free_hstat (&hstat);
|
|
||||||
xfree_null (dummy);
|
|
||||||
return RETROK;
|
|
||||||
}
|
|
||||||
else /* the same, but not accepted */
|
|
||||||
{
|
|
||||||
logprintf (LOG_VERBOSE,
|
|
||||||
_("%s (%s) - Connection closed at byte %s/%s. "),
|
|
||||||
tms, tmrate,
|
|
||||||
number_to_static_string (hstat.len),
|
|
||||||
number_to_static_string (hstat.contlen));
|
|
||||||
printwhat (count, opt.ntry);
|
|
||||||
free_hstat (&hstat);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else /* now hstat.res can only be -1 */
|
else /* now hstat.res can only be -1 */
|
||||||
{
|
{
|
||||||
|
@ -173,7 +173,6 @@ static struct {
|
|||||||
#endif
|
#endif
|
||||||
{ "input", &opt.input_filename, cmd_file },
|
{ "input", &opt.input_filename, cmd_file },
|
||||||
{ "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
|
{ "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
|
||||||
{ "killlonger", &opt.kill_longer, cmd_boolean },
|
|
||||||
{ "limitrate", &opt.limit_rate, cmd_bytes },
|
{ "limitrate", &opt.limit_rate, cmd_bytes },
|
||||||
{ "loadcookies", &opt.cookies_input, cmd_file },
|
{ "loadcookies", &opt.cookies_input, cmd_file },
|
||||||
{ "logfile", &opt.lfilename, cmd_file },
|
{ "logfile", &opt.lfilename, cmd_file },
|
||||||
|
@ -35,9 +35,6 @@ struct options
|
|||||||
int ntry; /* Number of tries per URL */
|
int ntry; /* Number of tries per URL */
|
||||||
bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */
|
bool retry_connrefused; /* Treat CONNREFUSED as non-fatal. */
|
||||||
bool background; /* Whether we should work in background. */
|
bool background; /* Whether we should work in background. */
|
||||||
bool kill_longer; /* Do we reject messages with *more*
|
|
||||||
data than specified in
|
|
||||||
content-length? */
|
|
||||||
bool ignore_length; /* Do we heed content-length at all? */
|
bool ignore_length; /* Do we heed content-length at all? */
|
||||||
bool recursive; /* Are we recursive? */
|
bool recursive; /* Are we recursive? */
|
||||||
bool spanhost; /* Do we span across hosts in
|
bool spanhost; /* Do we span across hosts in
|
||||||
|
Loading…
Reference in New Issue
Block a user