curl: fix --upload-file . hangs if delay in STDIN

Attempt to unpause a busy read in the CURLOPT_XFERINFOFUNCTION.

When uploading from stdin in non-blocking mode, a delay in reading
the stream (EAGAIN) causes curl to pause sending data
(CURL_READFUNC_PAUSE).  Prior to this change, a busy read was
detected and unpaused only in the CURLOPT_WRITEFUNCTION handler.
This change performs the same busy read handling in a
CURLOPT_XFERINFOFUNCTION handler.

Fixes #2051
Closes #4599
Reported-by: bdry on github
This commit is contained in:
John Schroeder 2019-11-26 09:16:19 +01:00 committed by Daniel Stenberg
parent 7cf18b05e0
commit 9a2cbf30b8
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 63 additions and 4 deletions

View file

@ -32,6 +32,7 @@
#include "tool_cfgable.h"
#include "tool_cb_prg.h"
#include "tool_util.h"
#include "tool_operate.h"
#include "memdebug.h" /* keep this as LAST include */
@ -121,7 +122,10 @@ int tool_progress_cb(void *clientp,
and this new edition inherits some of his concepts. */
struct timeval now = tvnow();
struct ProgressData *bar = (struct ProgressData *)clientp;
struct per_transfer *per = clientp;
struct OutStruct *outs = &per->outs;
struct OperationConfig *config = outs->config;
struct ProgressData *bar = &per->progressbar;
curl_off_t total;
curl_off_t point;
@ -191,6 +195,11 @@ int tool_progress_cb(void *clientp,
bar->prev = point;
bar->prevtime = now;
if(config->readbusy) {
config->readbusy = FALSE;
curl_easy_pause(per->curl, CURLPAUSE_CONT);
}
return 0;
}