cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: SSL and basic authentication.

From: Josef Wolf <jw_at_raven.inka.de>
Date: Wed, 22 Oct 2008 01:06:14 +0200

On Tue, Oct 21, 2008 at 11:05:38PM +0200, Daniel Stenberg wrote:

Thanks for the answer, Daniel!

> On Tue, 21 Oct 2008, Josef Wolf wrote:
>
> >But before I start asking questions about how git uses curl, I want to get
> >some basic understanding, so I did some tests.
>
> I think you should save questions about git's use of (lib)curl for the git
> list.

You're right, but I need to get some understanding about the design
of libcurl first.

> AFAIK, git uses only libcurl these days and that's the reason for
> example ~/.curlrc doesn't matter since that's a curl feature, not a libcurl
> one.

OK, I see.

> >Next problem is that curl don't ask credentials on a 401 error. Is this
> >really the right thing to do? I always thought that on 401, the
> >user-agent should present the realm, ask the user for credentials, and
> >finally retry the request with the supplied credentials. At least, this
> >is how I understand
>
> We could discuss if curl the tool should do that (but that should be taken
> to the curl-users list), but libcurl the library won't and can't.

I think the task can cleanly be divided into two parts:

1. The application part: This part is responsible to provide credentials
   by whatever mechanism it implements (cache, config files, ask the user
   ether on command line or via GUI). I agree that all of this is out of
   scope of the library. But IMHO, the application can use some help from
   the library to do all this, so we come to the second part:

2. The library part: This part should detect the 401, call a callback
   into the application to retrieve the credentials, and finally retry
   the request with the supplied credentials. The callback would have
   a signature like this:

     int curl_get_credentials (char *realm, char *url, int isproxy)

   or something.

BTW: I thought curl-library list was not only about internals of the
     library but also about how to use the library?
Received on 2008-10-22