cURL / Mailing Lists / curl-library / Single Mail


Re: quick question about share interface

From: Daniel Stenberg <>
Date: Mon, 26 Sep 2005 22:58:27 +0200 (CEST)

On Fri, 23 Sep 2005, Mehmet Fidanboylu wrote:

> 1. I will be using multiple CURL handles simultaneously and I need a central
> context from which to serve data to these handles.

As long as you use separate CURL handles in different threads, you have no
worries at all.

> As I was going thru the code, I realized this can be done using the share
> interface. However, I believe the share interface is limited to sharing
> cookies and DNS caching.

That is mainly due to those being the only things we've so far written support

> I would also like to be able to share the authentication parameters across
> handles.

What kind of authentication parameters are you referring to here?

> I believe the Curl_share struct is analogous to a context, so is extending
> the share interface (and this construct), plus enhancing the code in
> transfer.c the right way to go here?

If you really need it in the share context then it sounds like a good way to

> 2. I realized that for the authentication schemes (out of which I will only
> use BASIC), realm is not a configurable.

Realm is something you get from the server. You mean you want to set a
user+password for a given realm?

If so, no it isn't supported.

> Is there a reason for this?

Nope, that's just how it works. It is very easy to track those headers with
your app and then set the proper credentials based on the realm (or any other
match as you see fit).

> I guess this enforces the handles to have one set of authentication
> parameters. Is this also an area open to extensions? or am I missing
> something here?

Not really. A 'CURL' handle holds N connection, and each one remembers that
user+password that is in use for that connection.

But yes, you can only set one user and password that you want. The reason is
simply that it kept the implementation so much easier. I could possibly be
persuaded into supporting multiple name/password pairs based on realm or
similar, but first I would like a good answer to why it would be necessary!

  Commercial curl and libcurl Technical Support:
Received on 2005-09-26