+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>
* ftp.c (max): Add definition.
- (getftp): Consider for`expected_bytes' the greatest value between the bytes
- count returned by SIZE and the bytes count returned by RETR.
+ (getftp): Consider for `expected_bytes' the greatest value between the
+ 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>
#define LIST_FILENAME ".listing"
#endif
-#define max(a, b) ((a > b) ? (a) : (b))
-
typedef struct
{
int st; /* connection status */
int cmd = con->cmd;
bool pasv_mode_open = false;
wgint expected_bytes = 0;
+ bool got_expected_bytes = false;
bool rest_failed = false;
int flags;
wgint rd_size;
con->csock = -1;
return err;
case FTPOK:
+ got_expected_bytes = true;
/* Everything is OK. */
break;
default:
if (!opt.server_response)
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);
} /* do retrieve */
if (cmd & DO_LIST)
}
if (!opt.server_response)
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 */
if (!(cmd & (DO_LIST | DO_RETR)) || (opt.spider && !(cmd & DO_LIST)))