cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: [Problems with Proxy Implementation with CURL/C++]

From: Gibran Akram <gibran.akram_at_gmail.com>
Date: Tue, 28 Oct 2008 12:14:31 +0600

Though I'm still camping on a possible network tweak or two, I don't think
that is the problem here. The CURLE_RECV_ERROR is returned only when CURL
sees that it cannot receive data (over a closed connection)

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Dan Fandrich
Sent: Tuesday, October 28, 2008 12:07 PM
To: curl-library_at_cool.haxx.se
Subject: Re: [Problems with Proxy Implementation with CURL/C++]

On Tue, Oct 28, 2008 at 11:32:22AM +0600, Gibran Akram wrote:
> The following is showing up in response headers:
>
> Initial global init: 0
> Handle initialised..
> URL : http://dataupdate.xxx.xxxxxxxxxx.com/xxxprofile/xxx.pro
> * About to connect() to proxy 192.168.1.xxx port 8080 (#0)
> * Trying 192.168.1.xxx... * connected
> * Connected to 192.168.1.xxx (192.168.1.xxx) port 8080 (#0)
> * Establish HTTP proxy tunnel to dataupdate.xxx.xxxxxxxxxx.com:80
> * Proxy auth using Basic with user 'xxxxx'
> * Server auth using Basic with user 'xxxxx_client'
> > CONNECT dataupdate.xxx.xxxxxxxxxx.com:80 HTTP/1.0
> Host: dataupdate.xxx.xxxxxxxxxx.com:80
> Proxy-Authorization: Basic bXdhcWFzOkFCQzEyM3NzaQ==
> Proxy-Connection: Keep-Alive
>
> < HTTP/1.0 403 Forbidden
> < Server: squid/2.6.STABLE18
> < Date: Tue, 28 Oct 2008 05:26:46 GMT
> < Content-Type: text/html
> < Content-Length: 1086
> < Expires: Tue, 28 Oct 2008 05:26:46 GMT
> < X-Squid-Error: ERR_ACCESS_DENIED 0
> < X-Cache: MISS from localhost
> < X-Cache-Lookup: NONE from localhost:8080
> < Via: 1.0 localhost:8080 (squid/2.6.STABLE18)
> < Proxy-Connection: close
> <
> * The requested URL returned error: 403
> * Received HTTP code 403 from proxy after CONNECT
> * Closing connection #0
> * Failure when receiving data from the peer
> Error curl_easy_perform : 56
> HTTP Connect Code :403

Hmmm, this does look suspiciously like a curl problem. The remote site
responds with Content-Length: 1086, indicating that it will be sending that
much data. However, curl reads the headers, decides that the request has
ended in an error 403, sees the Proxy-Connection: close header and just
closes the connection. For one thing, the app might want those 1086 bytes
so curl ought not to close the connection right away. Also, there wasn't
an actual "Failure when receiving data from the peer" so it shouldn't return
an CURLE_RECV_ERROR.

curl does this for me with the command line:

curl -v --proxytunnel --proxy localhost:80 http://localhost/

when localhost:80 is not running a proxy server and therefore returns error
501. Removing the --proxytunnel option makes curl behave as expected.

>>> Dan

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