cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-users Mailing List Archives

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

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET