mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
[svn] Make sure opt.dfp is rewound only on the first retrieval.
(See the code comment for a more detailed explanation.) Published in <sxsy9tkqizz.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
c6def234a8
commit
66a0c39e22
@ -814,8 +814,13 @@ Error in server response, closing control connection.\n"));
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
extern int global_download_count;
|
||||||
fp = opt.dfp;
|
fp = opt.dfp;
|
||||||
if (!restval)
|
|
||||||
|
/* Rewind the output document if the download starts over and if
|
||||||
|
this is the first download. See gethttp() for a longer
|
||||||
|
explanation. */
|
||||||
|
if (!restval && global_download_count == 0)
|
||||||
{
|
{
|
||||||
/* This will silently fail for streams that don't correspond
|
/* This will silently fail for streams that don't correspond
|
||||||
to regular files, but that's OK. */
|
to regular files, but that's OK. */
|
||||||
|
16
src/http.c
16
src/http.c
@ -1285,8 +1285,22 @@ Accept: %s\r\n\
|
|||||||
}
|
}
|
||||||
else /* opt.dfp */
|
else /* opt.dfp */
|
||||||
{
|
{
|
||||||
|
extern int global_download_count;
|
||||||
fp = opt.dfp;
|
fp = opt.dfp;
|
||||||
if (!hs->restval)
|
/* To ensure that repeated "from scratch" downloads work for -O
|
||||||
|
files, we rewind the file pointer, unless restval is
|
||||||
|
non-zero. (This works only when -O is used on regular files,
|
||||||
|
but it's still a valuable feature.)
|
||||||
|
|
||||||
|
However, this loses when more than one URL is specified on
|
||||||
|
the command line the second rewinds eradicates the contents
|
||||||
|
of the first download. Thus we disable the above trick for
|
||||||
|
all the downloads except the very first one.
|
||||||
|
|
||||||
|
#### A possible solution to this would be to remember the
|
||||||
|
file position in the output document and to seek to that
|
||||||
|
position, instead of rewinding. */
|
||||||
|
if (!hs->restval && global_download_count == 0)
|
||||||
{
|
{
|
||||||
/* This will silently fail for streams that don't correspond
|
/* This will silently fail for streams that don't correspond
|
||||||
to regular files, but that's OK. */
|
to regular files, but that's OK. */
|
||||||
|
@ -54,6 +54,9 @@ LARGE_INTEGER internal_time;
|
|||||||
static long internal_secs, internal_msecs;
|
static long internal_secs, internal_msecs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* See the comment in gethttp() why this is needed. */
|
||||||
|
int global_download_count;
|
||||||
|
|
||||||
void logflush PARAMS ((void));
|
void logflush PARAMS ((void));
|
||||||
|
|
||||||
/* From http.c. */
|
/* From http.c. */
|
||||||
@ -572,6 +575,8 @@ retrieve_url (const char *origurl, char **file, char **newloc,
|
|||||||
else
|
else
|
||||||
xfree (url);
|
xfree (url);
|
||||||
|
|
||||||
|
++global_download_count;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user