mirror of
https://github.com/curl/curl.git
synced 2026-08-25 03:53:31 +03:00
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:
parent
7cf18b05e0
commit
9a2cbf30b8
6 changed files with 63 additions and 4 deletions
|
|
@ -1080,11 +1080,11 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||
isatty(fileno(outs->stream)))
|
||||
/* we send the output to a tty, therefore we switch off the progress
|
||||
meter */
|
||||
global->noprogress = global->isatty = TRUE;
|
||||
per->noprogress = global->noprogress = global->isatty = TRUE;
|
||||
else {
|
||||
/* progress meter is per download, so restore config
|
||||
values */
|
||||
global->noprogress = orig_noprogress;
|
||||
per->noprogress = global->noprogress = orig_noprogress;
|
||||
global->isatty = orig_isatty;
|
||||
}
|
||||
|
||||
|
|
@ -1573,7 +1573,14 @@ static CURLcode single_transfer(struct GlobalConfig *global,
|
|||
/* we want the alternative style, then we have to implement it
|
||||
ourselves! */
|
||||
my_setopt(curl, CURLOPT_XFERINFOFUNCTION, tool_progress_cb);
|
||||
my_setopt(curl, CURLOPT_XFERINFODATA, &per->progressbar);
|
||||
my_setopt(curl, CURLOPT_XFERINFODATA, per);
|
||||
}
|
||||
else if(per->uploadfile && !strcmp(per->uploadfile, ".")) {
|
||||
/* when reading from stdin in non-blocking mode, we use the progress
|
||||
function to unpause a busy read */
|
||||
my_setopt(curl, CURLOPT_NOPROGRESS, 0L);
|
||||
my_setopt(curl, CURLOPT_XFERINFOFUNCTION, tool_readbusy_cb);
|
||||
my_setopt(curl, CURLOPT_XFERINFODATA, per);
|
||||
}
|
||||
|
||||
/* new in libcurl 7.24.0: */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue