- Eric Wong introduced support for the new option -T. (dot) that makes curl

read stdin in a non-blocking fashion. This also brings back -T- (minus) to
  the previous blocking behavior since it could break stuff for people at
  times.
This commit is contained in:
Daniel Stenberg 2009-08-24 10:57:17 +00:00
parent 6ede4ce79d
commit 95c2b205a4
4 changed files with 24 additions and 6 deletions

View File

@ -6,6 +6,12 @@
Changelog
Daniel Stenberg (24 Aug 2009)
- Eric Wong introduced support for the new option -T. (dot) that makes curl
read stdin in a non-blocking fashion. This also brings back -T- (minus) to
the previous blocking behavior since it could break stuff for people at
times.
Michal Marek (21 Aug 2009)
- With CURLOPT_PROXY_TRANSFER_MODE, avoid sending invalid URLs like
ftp://example.com;type=i if the user specified ftp://example.com without the

View File

@ -9,7 +9,7 @@ Curl and libcurl 7.19.7
This release includes the following changes:
o
o -T. is now for non-blocking uploading from stdin
This release includes the following bugfixes:
@ -19,6 +19,7 @@ This release includes the following bugfixes:
o data corruption issue with re-connected transfers
o use after free if we're completed but easy_conn not NULL (pipelined)
o missing strdup() return code check
o CURLOPT_PROXY_TRANSFER_MODE could pass along wrong syntax
This release includes the following known bugs:
@ -27,6 +28,7 @@ This release includes the following known bugs:
This release would not have looked like this without help, code, reports and
advice from friends like these:
Karl Moerder, Kamil Dudka, Krister Johansen, Andre Guibert de Bruet
Karl Moerder, Kamil Dudka, Krister Johansen, Andre Guibert de Bruet,
Michal Marek, Eric Wong
Thanks! (and sorry if I forgot to mention someone)

View File

@ -1183,6 +1183,9 @@ file name to use. That will most likely cause the upload operation to fail. If
this is used on a HTTP(S) server, the PUT command will be used.
Use the file name "-" (a single dash) to use stdin instead of a given file.
Alternately, the file name "." (a single period) may be specified instead
of "-" to use stdin in non-blocking mode to allow reading server output
while stdin is being uploaded.
You can specify one -T for each URL on the command line. Each -T + URL pair
specifies what to upload and to where. curl also supports "globbing" of the -T

View File

@ -3953,6 +3953,10 @@ static void dumpeasycode(struct Configurable *config)
curl_slist_free_all(easycode);
}
static bool stdin_upload(const char *uploadfile)
{
return curlx_strequal(uploadfile, "-") || curlx_strequal(uploadfile, ".");
}
static int
operate(struct Configurable *config, int argc, argv_item_t argv[])
@ -4417,7 +4421,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
}
}
infdopen=FALSE;
if(uploadfile && !curlx_strequal(uploadfile, "-")) {
if(uploadfile && !stdin_upload(uploadfile)) {
/*
* We have specified a file to upload and it isn't "-".
*/
@ -4511,11 +4515,14 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
uploadfilesize=fileinfo.st_size;
}
else if(uploadfile && curlx_strequal(uploadfile, "-")) {
else if(uploadfile && stdin_upload(uploadfile)) {
SET_BINMODE(stdin);
infd = STDIN_FILENO;
if (curlx_strequal(uploadfile, ".")) {
if (curlx_nonblock((curl_socket_t)infd, TRUE) < 0)
warnf(config, "fcntl failed on fd=%d: %s\n", infd, strerror(errno));
warnf(config,
"fcntl failed on fd=%d: %s\n", infd, strerror(errno));
}
}
if(uploadfile && config->resume_from_current)