cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP Autentication

From: Dobromir Velev <diadomraz_at_gmail.com>
Date: Tue, 11 Jan 2005 16:28:57 +0200

Hi,
Thank you very much - this is exactly what I was looking for. I should have
read the manual more carefully.

Best regards
Dobromir Velev

On Tuesday 11 January 2005 15:47, you wrote:
> 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?
Received on 2005-01-11