curl-users
Upload parameters AND data from stdin (-K - -T-)
Date: Wed, 20 Aug 2003 10:17:41 -0400
While the subject of command line options is floating around, I'd
like to propose that curl be able to accept parameters and upload
data via stdin. A test case might be something like:
( echo -q
echo -s
echo -P -
echo -u id:password
echo -T -
echo --url ftp://site/path
echo --end-parms
cat uploadfile ) | curl -K -
This avoids any sensitive data on the command line. All or part of
the parameters can come via standard in. This would work nicely
in popen-like environments and also support "canned" transfers
in the form:
curl -K - < commandAndDataFile
Seems there are two things needed to do this:
1) The parser must have a clear way to stop taking parameters.
One way to do this would be to add a parameter to indicate end of
parameters, such as --end-parms, above. The convention could be
something like all data following the line feed at the end of
the --end-parms line would be considered to be upload data.
Perhaps --end-parms could be abreviated "--". (Perhaps
"everything from stdin" mode could be abbreviated "curl -".)
Another option would be to have a single control character such
as EOT (hex 04) and/or ETX (hex 03) delimit the parameter portion
of the input stream.
2) The upload input routine must have a way to start out with
the data immediately following the parameters.
I think this implies some sort of common stdin routine to
deal with the partial buffer. To be honest, I got lost
trying to figure out how this could be cleanly done.
-=-
One other related thought would be to expand on the notion
of "-" meaning stdin. Why not allow digits immediately
following the dash to represent a file descriptor number?
"-" is equivalent to "-0" (dash zero), stdin. "-11" would
mean file descriptor 11. Thus a parent program could have
files/pipes open on various fds and fork exec/system/popen
a curl child process to transfer to/from them.
-=-
Please excuse any inaccuracies in the above. I haven't
had time to properly study these, just take a quick glance.
Cheers!
Rich
[snip big sig]
-------------------------------------------------------
This SF.net email is sponsored by Dice.com.
Did you know that Dice has over 25,000 tech jobs available today? From
careers in IT to Engineering to Tech Sales, Dice has tech jobs from the
best hiring companies. http://www.dice.com/index.epl?rel_code4
Received on 2003-08-20