mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
Rewrite last change considering SIZE return value, otherwise what RETR returns
This commit is contained in:
parent
6ef8c69c9d
commit
29305e059f
@ -1,8 +1,16 @@
|
|||||||
|
2010-07-14 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* ftp.c (max): Remove definition.
|
||||||
|
(getftp): New variable `got_expected_bytes'. Let `expected_bytes' be
|
||||||
|
the value SIZE returns, otherwise use the bytes count returned by RETR.
|
||||||
|
Suggested by Daniel Stenberg <daniel@haxx.se>.
|
||||||
|
|
||||||
2010-07-14 Giuseppe Scrivano <gscrivano@gnu.org>
|
2010-07-14 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
* ftp.c (max): Add definition.
|
* ftp.c (max): Add definition.
|
||||||
(getftp): Consider for`expected_bytes' the greatest value between the bytes
|
(getftp): Consider for `expected_bytes' the greatest value between the
|
||||||
count returned by SIZE and the bytes count returned by RETR.
|
bytes count returned by SIZE and the bytes count returned by RETR.
|
||||||
|
Reported by: Jozua <jozua@sparky.za.net>.
|
||||||
|
|
||||||
2010-07-11 Giuseppe Scrivano <gscrivano@gnu.org>
|
2010-07-11 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
13
src/ftp.c
13
src/ftp.c
@ -63,8 +63,6 @@ as that of the covered work. */
|
|||||||
#define LIST_FILENAME ".listing"
|
#define LIST_FILENAME ".listing"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define max(a, b) ((a > b) ? (a) : (b))
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int st; /* connection status */
|
int st; /* connection status */
|
||||||
@ -254,6 +252,7 @@ getftp (struct url *u, wgint passed_expected_bytes, wgint *qtyread,
|
|||||||
int cmd = con->cmd;
|
int cmd = con->cmd;
|
||||||
bool pasv_mode_open = false;
|
bool pasv_mode_open = false;
|
||||||
wgint expected_bytes = 0;
|
wgint expected_bytes = 0;
|
||||||
|
bool got_expected_bytes = false;
|
||||||
bool rest_failed = false;
|
bool rest_failed = false;
|
||||||
int flags;
|
int flags;
|
||||||
wgint rd_size;
|
wgint rd_size;
|
||||||
@ -757,6 +756,7 @@ Error in server response, closing control connection.\n"));
|
|||||||
con->csock = -1;
|
con->csock = -1;
|
||||||
return err;
|
return err;
|
||||||
case FTPOK:
|
case FTPOK:
|
||||||
|
got_expected_bytes = true;
|
||||||
/* Everything is OK. */
|
/* Everything is OK. */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1022,8 +1022,8 @@ Error in server response, closing control connection.\n"));
|
|||||||
if (!opt.server_response)
|
if (!opt.server_response)
|
||||||
logputs (LOG_VERBOSE, _("done.\n"));
|
logputs (LOG_VERBOSE, _("done.\n"));
|
||||||
|
|
||||||
expected_bytes = max (ftp_expected_bytes (ftp_last_respline),
|
if (! got_expected_bytes)
|
||||||
expected_bytes);
|
expected_bytes = ftp_expected_bytes (ftp_last_respline);
|
||||||
} /* do retrieve */
|
} /* do retrieve */
|
||||||
|
|
||||||
if (cmd & DO_LIST)
|
if (cmd & DO_LIST)
|
||||||
@ -1069,8 +1069,9 @@ Error in server response, closing control connection.\n"));
|
|||||||
}
|
}
|
||||||
if (!opt.server_response)
|
if (!opt.server_response)
|
||||||
logputs (LOG_VERBOSE, _("done.\n"));
|
logputs (LOG_VERBOSE, _("done.\n"));
|
||||||
expected_bytes = max (ftp_expected_bytes (ftp_last_respline),
|
|
||||||
expected_bytes);
|
if (! got_expected_bytes)
|
||||||
|
expected_bytes = ftp_expected_bytes (ftp_last_respline);
|
||||||
} /* cmd & DO_LIST */
|
} /* cmd & DO_LIST */
|
||||||
|
|
||||||
if (!(cmd & (DO_LIST | DO_RETR)) || (opt.spider && !(cmd & DO_LIST)))
|
if (!(cmd & (DO_LIST | DO_RETR)) || (opt.spider && !(cmd & DO_LIST)))
|
||||||
|
Loading…
Reference in New Issue
Block a user