cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Proxy authentication does not work if several types was set

From: Casey ODonnell <caseyodonnell_at_gmail.com>
Date: Mon, 18 Apr 2005 10:27:11 -0400

CURLOPT_PROXYAUTH

Pass a long as parameter, which is set to a bitmask, to tell libcurl
what authentication method(s) you want it to use for your proxy
authentication. If more than one bit is set, libcurl will first query
the site to see what authentication methods it supports and then pick
the best one you allow it to use. Note that for some methods, this
will induce an extra network round-trip. Set the actual name and
password with the CURLOPT_PROXYUSERPWD option. The bitmask can be
constructed by or'ing together the bits listed above for the
CURLOPT_HTTPAUTH option. As of this writing, only Basic and NTLM work.
(Added in 7.10.7)

> curl_easy_setopt(m_curlHandle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
> curl_easy_setopt(m_curlHandle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);

You're not sending a bitmask. You're sending two separate settings. OF
COURSE it uses Basic, because that's the last thing you send. It
overwrites the previous.

On 4/18/05, Pavel Orehov <pcarlo_at_bezeqint.net> wrote:
> Hi,
>
> I am working with libcurl with multi stack.
>
> I want libcurl sample with authentication method required from
> proxy and then send appropriate one, but this does not work.
>
> std::string cred("user:pass");
> curl_easy_setopt(m_curlHandle, CURLOPT_PROXYUSERPWD,
> cred.c_str());
> curl_easy_setopt(m_curlHandle, CURLOPT_PROXYAUTH, CURLAUTH_NTLM);
> curl_easy_setopt(m_curlHandle, CURLOPT_PROXYAUTH, CURLAUTH_BASIC);
>
> In this way it should sample proxy method and then use
> appropriate one, but actually next scenario heppens:
> - curl send request with Basic headers included
> - proxy response with 407 and NTLM required in headers
> - curl return 407 to client
>
> It looks like a BUG !!!
>

-- 
Casey O'Donnell
RPI STS Department - Graduate Student
http://homepage.mac.com/codonnell/
http://homepage.mac.com/codonnell/wxsync/
http://homepage.mac.com/codonnell/wxblogger/
Received on 2005-04-18