cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: HTTP 401- Unauthorized error.

From: Pankaj Kumar Maharana <maharana.pankaj_at_gmail.com>
Date: Fri, 1 May 2009 13:18:14 +0530

Daniel,

Still it did not solve the issue.. I tried by setting CURLOPT_HTTPAUTH to
CURLAUTH_BASIC. But I found a new use case. The new use case is that if I
set CURLAUTH_BASIC with the initial request itself than I did not get any
response at all. So I tried setting CURLAUTH_ANY with the initial request.
But when I get 401 error than set CURLAUTH_BASIC with the username and
password from header callback. Here I observed that the issue of not sending
second time is still there with this approach also.

The issue is, with the same handle when i am setting a new username and
password than CURL does not send that information to the server. Instead it
gives back the response body through write_callback function. I understand
that it is not the correct behaviour. If I am setting username and password
with the same handle than CURL need to send the info to server and need to
call header_callback with the response header. Does the return value of
header_callback function keep some impact on this(For not sending the
request again)?

What I don’t understand is , is this the curl behaviour or there is some
options to set which i am missing.

Thanks,

Pankaj
Received on 2009-05-01