cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Incorrect file download on proxy authentication failure

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 22 Oct 2008 14:39:13 -0700

On Wed, Oct 22, 2008 at 04:15:41PM -0400, Sourjo Basu wrote:
> > Curl_easy_perform returns CURLE_OK which it should
> > not since the proxy authentication failed. For example I am
> > trying to download a test.c file which contains a few lines
> > of code, but instead I get a xml type error log with that
> > filename (test.c).
> >
> > I think libcurl should return an error (maybe #67
> > CURLE_LOGIN_DENIED) instead of writing the error log to the
> > file and saving it. I am attaching a verbose log of the
> > transfer to this email and also the incorrect test.c file
> > that was created in the download directory. I am using 7.18.2.
>
> I think I found the problem, I changed the return value of the
> Curl_http_input_auth function in http.c from CURLE_OK to
> CURLE_LOGIN_DENIED. Now my ftp app works without any problems for
> incorrect proxy username/password. But I'm not sure what else this
> change might affect, it is probably a hack for my specific need (proxy
> auth). I would appreciate some input on this.

libcurl considers the reception of an error page from the proxy or server
as a successful transfer, so it returns CURLE_OK. If you want to get
the HTTP error code, get it with CURLINFO_RESPONSE_CODE using
curl_easy_getinfo

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-10-22