cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Error handling:-- Http-401: Unauthorized in CURL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 30 Mar 2009 16:16:19 +0200 (CEST)

On Mon, 30 Mar 2009, Pankaj Kumar Maharana wrote:

... and this is libcurl talk so curl-library would be the better mailing list
to talk about this on!

> How to successfully handle Http error code 401(Unauthorized) in CURL.
>
> In my programm, I am setting
>
> curl_easy_setopt(curl__handle, CURLOPT_HEADERFUNCTION,
> header_callback_function);
> curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH,
> CURLAUTH_BASIC|CURLAUTH_DIGEST);
>
> What I found is if we do not set curl_easy_setopt(curl_handle,
> CURLOPT_USERPWD, "_:_"); {Kind of dummy username password} with the initial
> request, Than header_callback_function() is not called by CURL for 401
> error.

Really? I don't see how the passing of data to or invoking the header callback
is changed if the USERPWD option is set or not. Can you show us a full example
repeating this? (To the curl-library list then)

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2009-03-30