cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Customizing 401 handling for http-digest authentication

From: Guru Prasad <bgurup.ndk_at_gmail.com>
Date: Fri, 31 Oct 2014 14:42:48 +0530

>
> If I want to modify the 401 response handling for digest authentication,
>> can I do this in the header callback function registered with libcurl (with
>> CURLOPT_HEADERFUNCTION option)?
>>
>
> Sure. Just don't use libcurl's built-in auth support and build your own
> instead.

Thanks, Daniel. How can I make libcurl not to use the built-in auth? Can
this be just done by not calling curl_easy_setopt(CurlHandler,
CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);? or is there any other alternates?
 Another question: If I had called this API already, and then, I want to
disable this, how can this be achieved?

> Can I use CURLOPT_HTTPHEADER option for this with curl_slist? In this
>> case, do I have to take care of all the headers or can I add only partial
>> headers which are specific to GBA and rest of the headers will be provided
>> by libcurl as part of the 401 response handling.
>>
>
> No can do. With CURLOPT_HTTPHEADER you add, replace or remove full headers
> only.

If I have Authorization header constructed by my module, then, in order to
use this Authorization header, should I be providing all the remaining
headers like Accept, Host, etc. in CURLOPT_HTTPHEADER?

One more question: If I am not using the libcurl built-in auth and I am
using my own implementation, in this case, once 401 Unauthorized processing
is done, I should be triggering the request again with the challenge
response, right? In this case, libcurl will not trigger the same request
with challenge response, is it (unlike in the case when CURLAUTH_DIGEST
auth is enabled)?

>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-library
> Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-31