cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: curl waits for stdin to "EOF" before firing requests when "-K -" is used to read config from stdin

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 16 Dec 2015 00:16:10 +0100

On Tue, Dec 15, 2015 at 10:47:54PM +0100, Daniel Stenberg wrote:
> On Tue, 15 Dec 2015, Xavier !! <M X > via curl-users wrote:
>
> >With "-K -" used to read the config from the stdin, curl waits until no
> >more input comes from stdin, and then executes all the HTTP requests 
>
> Correct. It reads the entire config file first, then performs.
>
> >Is there any way to avoid that and make curl execute each request as soon
> >as they are coming from stdin ?
>
> >Did I miss something, or is there really no way to achieve that in the
> >current version ?Is this "just" not implemented or is there any reasons
> >that would make such a behaviors impossible ?
>
> If you think about it further, you realize it isn't possible. The options
> read on the command line and config file are all considered, and their
> individual order is mostly not important. It means that the entire config
> file needs to be read first to get to know all the command line options that
> are used.

The --next option opens up the possibility of adding a feature to do this.
Essentially, curl would parse options up to the --next, fire off the transfer,
then continue parsing where it left off when it finishes. This would have to
be under the control of yet another option to preserve backward compatibility,
but it would enable some interesting new behaviour. For example, an application
could remote-control a copy of curl through a pipe and send it a set of URLs
computed dynamically, yet curl could keep its connection open for reduced
latency on subsequent transfers. This would be much easier than writing against
the libcurl API and would be an alternative when a binding isn't available. it
would also speed up transfers when curl is used at the end of a shell pipeline
where a large list of URLs is computed and passed in.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-12-16