cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP Autentication

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 11 Jan 2005 14:47:00 +0100 (CET)

On Tue, 11 Jan 2005, Dobromir Velev wrote:

> when username & password are added to the curl options they are always sent
> with a HTTP Autorization request no matter the site requested them or not. I
> don't if this is a bug or if it was made this way for a reason.

It is made like this for a reason.

> Currently what I do is to sent a HTTP request without the credentials and if
> the server responds with a 401 (Unautorized) and if a "WWW Autenticate..."
> header is present in the response I make the second request with the
> credentials, but I would prefer to have this functionality within curl.

You can, by setting CURLOPT_HTTPAUTH to CURLAUTH_ANY (or similar, the point
being that more than one type should be asked for), as then libcurl won't know
what auth type to use and it won't use any until the server has responded with
a 401 and a list of types it supports.

That good enough?

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2005-01-11