cURL / Mailing Lists / curl-users / Single Mail


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

From: Daniel Stenberg <>
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,
> 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)

List admin:
Received on 2009-03-30