cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

Re: Question about CURLOPT_HTTPAUTH

From: James Gallagher <jgallagher_at_gso.uri.edu>
Date: 28 Jul 2003 15:50:32 -0700

On Mon, 2003-07-28 at 15:23, Daniel Stenberg wrote:
> On Mon, 28 Jul 2003, James Gallagher wrote:
>
> > I have a possibly naive question about the HTTPAUTH feature of
> > libcurl-7.10.6. I have an application that needs to use authentication.
> > Basic authentication is OK, but I'd prefer Digest. When I call:
> >
> > curl_easy_setopt(d_curl, CURLOPT_HTTPAUTH, (long)CURLAUTH_BASIC);
> >
> > Authentication works just fine. However, when I use:
> >
> > (long)(CURLAUTH_BASIC|CURLAUTH_DIGEST)
> >
> > or just CURLAUTH_DIGEST alone, authentication fails. I can see with VERBOSE
> > and a DEBUGFUNCTION that with CURLAUTH_BASIC an Authorization header is send
> > to the server (here's what it looks like: Authorization: Basic
> > amltZzp3YXNfcXVpdA==, which seems odd since I thought with Basic
> > authenticationthe username and password would be sent as plain text...) but
> > with BASIC|DIGEST or DIGEST, there's no such header.
>
> First, the Basic credentials are plain text base64 encoded. (As Scott already
> mentioned.)
>
> Digest authentication requires an initial request to get a "WWW-Authenticate:
> Digest" header back that contains the nonce needed for doing subsequent
> request which then should get a proper response back (if the name and password
> are correct).
>
> > Can anybody tell me how to get Digest authentication working or what I'm
> > doing wrong? If so, I'd really appreciate it.
>
> What headers do you get back in the first response?

Here's the first response, where HTTPAUTH is set to
CURLAUTH_DIGEST|CURLAUTH_BASIC:

        * About to connect() to comet.dods.org:80
        * Connected to comet.dods.org (192.168.1.4) port 80
> GET /secure-3.4/nph-dods/version HTTP/1.1
        Host: comet.dods.org
        Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
        Accept-Encoding: deflate
        User-Agent: DODS DAP++/3.4.0
        Accept-Encoding: deflate
         
        * The requested URL returned error: 401
        * Connection #0 left intact
        The requested URL returned error: 401
        * Closing connection #0

Thanks,
James

> (I just now wrote up a fresh test case that tests Basic or Digest, and it
> seems to work fine...)

-- 
__________________________________________________________________________
James Gallagher		         The Distributed Oceanographic Data System
jgallagher@gso.uri.edu               http://unidata.ucar.edu/packages/dods
Voice: 775.337.8612					 Fax: 775.337.2105
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
Received on 2003-07-29

These mail archives are generated by hypermail.

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

File upload with ASP.NET