cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl 7.18.1 proxy ipv6

From: Pramod Sharma <pramodsharma08_at_gmail.com>
Date: Thu, 31 Jul 2008 17:27:40 +0530

On Thu, Jul 31, 2008 at 3:01 PM, Pramod Sharma <pramodsharma08_at_gmail.com>wrote:

> Hi ,
> I am using curl 7.18.1 for my development and facing some issues with IPV6
> address when using proxy (Tried with Apache , squid both). May be you guys
> can give me some better direction to trouble shoot the issue.
>
> Configurations :
> 1. Apache 2.2.9 which supports ftp, http and IPV6 and can act as proxy
> server
> 2. libcurl 7.18.1 for my development
>
> Issue :
> - With Command line curl it's working fine and with my test code it's not
> - Without proxy it's working
>
>
> *My test code *
> #include "curl/curl.h"
> #include <iostream>
> int main(int argc , char *argv[])
> {
> CURL *curl = curl_easy_init();
> curl_easy_setopt(curl,CURLOPT_PORT,21);
> curl_easy_setopt(curl,CURLOPT_VERBOSE,1);
> //Proxy configuration
>
> curl_easy_setopt(curl,CURLOPT_PROXY,"[2001:db8:0:1:203:ffff:fee1:2a22]");
> curl_easy_setopt(curl,CURLOPT_PROXYPORT,80);
>
> curl_easy_setopt(curl,CURLOPT_PROXYAUTH,CURLAUTH_ANY);
> curl_easy_setopt(curl,CURLOPT_USERPWD , "pramod:root123");
> curl_easy_setopt(curl,CURLOPT_URL , "
> ftp://[2001:db8:0:1:203:ffff:fee1:2a22]:21//<ftp://[2001:db8:0:1:203:ffff:fee1:2a22]//SiteStat.xml>
> SiteStat.xml");
> CURLcode response = curl_easy_perform(curl);
> std::cout << curl_easy_strerror(response) << std::endl;
> }
> Curl Command line
> curl -6 -g ftp://[2001:db8:0:1:203:ffff:fee1:2a22]:21/SiteStat.xml<ftp://[2001:db8:0:1:203:ffff:fee1:2a22]/SiteStat.xml>--user pramod:root123 --proxy [2001:db8:0:1:203:ffff:fee1:2a22]:80
>
>
> *Output from my test program :*
> ** About to connect() to proxy 2001:db8:0:1:203:ffff:fee1:2a22 port 80
> (#0)
> * Trying 2001:db8:0:1:203:ffff:fee1:2a22... * connected
> * Connected to 2001:db8:0:1:203:ffff:fee1:2a22
> (2001:db8:0:1:203:ffff:fee1:2a22) port 80 (#0)
> * Server auth using Basic with user 'pramod'
> > GET **ftp://2001:db8:0:1:203:ffff:fee1:2a22:21/SiteStat.xml*<ftp://2001:db8:0:1:203:ffff:fee1:2a22:21/SiteStat.xml>
> * HTTP/1.1
> Authorization: Basic cHJhbW9kOnJvb3QxMjM=
> Host: [2001:db8:0:1:203:ffff:fee1:2a22]:21
> Pragma: no-cache
> Accept: */*
> Proxy-Connection: Keep-Alive*
> *< HTTP/1.1 400 Bad Request
> < Date: Thu, 31 Jul 2008 09:43:52 GMT
> < Server: Apache/2.2.9 (Unix)
> < Content-Length: 226
> < Connection: close
> < Content-Type: text/html; charset=iso-8859-1
> <
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
> <html><head>
> <title>400 Bad Request</title>
> </head><body>
> <h1>Bad Request</h1>
> <p>Your browser sent a request that this server could not understand.<br />
> </p>
> </body></html>
> * Closing connection #0
> No error*
>
> **
> *Output from curl command line*
> *<?xml version="1.0" encoding="UTF-8"?>
> <SiteStatus >
> </SiteStatus>*
>
> **
> *Thanks ,*
> *Pramod*
>
>
>

Verbose output from command line :
* About to connect() to proxy 2001:db8:0:1:203:ffff:fee1:2a22 port 80 (#0)
* Trying 2001:db8:0:1:203:ffff:fee1:2a22... connected
* Connected to 2001:db8:0:1:203:ffff:fee1:2a22
(2001:db8:0:1:203:ffff:fee1:2a22) port 80 (#0)
* Server auth using Basic with user 'pramod'
> GET ftp://[2001:db8:0:1:203:ffff:fee1:2a22]:21/SiteStat.xml<ftp://[2001:db8:0:1:203:ffff:fee1:2a22]/SiteStat.xml>HTTP/1.1
> Authorization: Basic cHJhbW9kOnJvb3QxMjM=
> User-Agent: curl/7.18.2 (i686-pc-linux-gnu) libcurl/7.18.2 zlib/1.2.3
> Host: [2001:db8:0:1:203:ffff:fee1:2a22]:21
> Pragma: no-cache
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 OK
< Date: Thu, 31 Jul 2008 12:21:54 GMT
< Server: Apache/2.2.9 (Unix)
< Content-Length: 118
< Content-Type: application/xml
< Last-Modified: Wed, 30 Jul 2008 09:23:39 GMT
<
<?xml version="1.0" encoding="UTF-8"?>
<SiteStatus >
</SiteStatus>

How come when running from command line is enclosing the GET request inside
[] , which is acceptable to proxy.
GET ftp://[2001:db8:0:1:203:ffff:fee1:2a22]:21/SiteStat.xml<ftp://[2001:db8:0:1:203:ffff:fee1:2a22]/SiteStat.xml>HTTP/1.1
.

Are they any curl_easy_setopt options to use for ?
Received on 2008-07-31