cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP Pipelining combined with CURLOPT_LOCALPORT

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 15 Dec 2010 23:28:30 +0100 (CET)

On Wed, 15 Dec 2010, Stefan Krause wrote:

>> I'm not sure we handle two handles bound to different local ports correctly
>> if you use them for pipelining. I say try it out and let us know what
>> works.

> Two handles with different local ports are pipelined over the same
> connection. The local ports aren't considered in this case (at least when
> the connection is already established). In case no connection exists yet on
> a multi handle (pipelined) then a connection is established bound to the
> local port of the first easy handle being processed.

Right, I suspected that. The function lib/url.c:ConnectionExists() should be
extended to also take bound local ports into account so that it doesn't re-use
connections that are both asked to be bound to specific ports, but it can
re-use a bound connection if only the new one isn't asked to be bound.

>>> Are muliple pipelines within ONE multi handle possible ?
>>
>> No.

> My first thought: Maybe that would be a solution to the behaviour with the
> local ports above? All handles with the same local ports are pipelined over
> the same conection / pipe. In case no connection for a local port exists,
> another pipe is with the local port is created inside the multi handle and
> used for all handles with a local port fitting to that new connection. ?

My answer was a bit short (to say it nice). There's no way to explicitly
control the number of pipelines. libcurl simply dictates what goes into a
pipeline and what doesn't.

When you ask for pipelining within a multi handle, libcurl will attempt to
pipeline every request you add and it will attempt to do that on the
connections that it already has. It can then create pipelines on every
connection that it has, which then can be a large amount.

If we just make sure ConnectionExists() takes the local port into account, it
should be possible to basically handicraft which requests go to which
pipelines by binding specific easy handles to specific local ports.

Or did I oversee anything?

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-12-15