Set interactive to true for bar progress.

* src/progress.c (bar_set_params): Set interactive to true.
* src/retr.c (fd_read_body): Avoid call fd_read with 0 timeout.
This commit is contained in:
Вячеслав Петрищев 2020-03-17 15:20:28 +06:00 committed by Tim Rühsen
parent fb5e2e628d
commit c12a295496
2 changed files with 10 additions and 1 deletions

View File

@ -499,6 +499,7 @@ dot_finish (void *progress, double dltime)
static void
dot_set_params (const char *params)
{
current_impl->interactive = false;
if (!params || !*params)
params = opt.dot_style;
@ -1365,6 +1366,13 @@ display_image (char *buf)
static void
bar_set_params (const char *params)
{
/* if run_with_timeout() will be used for read, needs to disable interactive bar,
or on every timeout(1s) we will have 'retry' with error "decryption failed" */
#if (defined(HAVE_LIBSSL) || defined(HAVE_LIBSSL32)) && defined(OPENSSL_RUN_WITHTIMEOUT)
current_impl->interactive = false;
#else
current_impl->interactive = true;
#endif
if (params)
{
for (const char *param = params; *param; )

View File

@ -425,7 +425,8 @@ fd_read_body (const char *downloaded_filename, int fd, FILE *out, wgint toread,
{
/* Don't let total idle time exceed read timeout. */
tmout = opt.read_timeout - waittm;
if (tmout < 0)
/* if 0 fd_read can be 'blocked read' */
if (tmout <= 0)
{
/* We've already exceeded the timeout. */
ret = -1, errno = ETIMEDOUT;