cURL / Mailing Lists / curl-library / Single Mail


Re: Sharing things

From: Daniel Stenberg <>
Date: Thu, 16 Jan 2003 14:11:19 +0100 (MET)

On Wed, 15 Jan 2003, Jean-Philippe Barrette-LaPierre wrote:

> You were thinking of using the share for DNS, but for connections, ssl
> connections and Cookies too, what do you exactly permit to do, what is the
> goal? It's not that I think that's not usefull, it's I just want to know
> exactly what you want, to implement it correctly.

Ok, here comes some ideas I've had on the particular areas you ask about:


 Each curl handle has a connection pool for keep connections for persistent
 connection use on repeated transfers.

 This pool should be able to share. So that several handles can use the same
 pool to check for an already present connection to pick, before initiating
 a new one.

 This will require a slightly different approach than the one currently used
 for a single handle, as now it checks for an existing one (match the host
 name, port number etc) and if that exists, it uses that. When using multiple
 handles, a matching connection may in fact already be in use by another
 handle and thus it must create a new connection for the same host+port+user
 combination (which then must be taken into account when the connection has
 been used and is put back in the pool as then we might get two connections
 in the pool for the same host+port+user, something that isn't possible

SSL session ids:

 (This is not connections)

 A session id is like a stored SSL-handshake with a particular site. When
 doing a second connection to a site we already had a connection to before,
 we can get a faster connection by using the pre-shaken handshake.

 Thus, by sharing the SSL session ids between multiple handles, when doing a
 new connection to a SSL site, the chance of being able to find an already
 existing session id increases.


 Cookies are simple variables with names, contents and properties. They are
 today stored per-handle basis which maskes it practicly impossible to do
 multi-threaded programs against a single site that uses cookies (like for
 the session etc) as each thread will have its own unique set of cookies.

 By allowing multiple handles to share the cookie "database", each handle can
 update or read the cookies from the same storage area and thus multiple
 threads can work easier on the same site.

 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
This SF.NET email is sponsored by:
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Received on 2003-01-16