cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Need suggestion o how to handle subsequent authorization challenge.

From: bch <brad.harder_at_gmail.com>
Date: Tue, 25 Nov 2014 08:57:02 -0800

I wonder if you could duplicate the handle and that would

a) inherit the authentication

b) be usable in a different thread

I've got *guesses*, but I'll leave commentary for somebody with specific
experience or firsthand knowledge.
On Nov 25, 2014 3:11 AM, "Arif Ali" <arif.ali.syed_at_gmail.com> wrote:

> Hello,
>
> I am using libCurl as backend for scale down browser of my own.
> Say I load a website called http://example.com and this site has
> auth challenge enabled. for now lets assume its Basic or NTLM
> challenge.
>
>
> I receive the WWW-Authenticate response header.
> I resend the request providing credential but this time using different
> curl handle.
> I get the response back, Now the home page http://example.com is loaded
> in webkit, web kit
> parses this figures out that it has load many JS,CSS and image files that
> are included in this.
>
> It fires multiple request for all this include files.
> for each request I have a separate thread, and separate curl handle is
> used i each thread.
>
> Now the problem that I am facing is since curl handle is not reused, every
> time I am getting authentication challenge.
> I can not reuse the curl handle because every request is made in different
> thread and curl handle can not be used
> across the multiple threads as per documentation.
>
> I do not want to prompt user several times for credentials for same
> website.
> How do I handle this scenario?
>
> While observing the Developer tools-> Network tab in firefox browser.
> I observe that for all subsequent request on same domain.
> Browser also receives the www-authentication challenge but then
> it send "Authorization" request header. So as a user I only have to
> authenticate once
>
> From user experience perspective I also want to do the same,
> Any suggestion how can it be done?
>
> Is there anyway I can get this authorization request header from curl
> handle and reuse it in
> subsequent requests ?
>
> -Arif
>
> -------------------------------------------------------------------
> 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-11-25