cURL / Mailing Lists / curl-library / Single Mail

curl-library

User-Agent on --proxytunnel?

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 9 Jul 2008 23:37:49 -0700

I noticed a bug when doing an ftp transfer through a --proxytunnel. In that
case curl obviously prints a NULL pointer:

$ curl -v --proxytunnel -x localhost:80 ftp://ftp.example.net
* About to connect() to proxy localhost port 80 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
* Establish HTTP proxy tunnel to ftp.example.net:21
> CONNECT ftp.example.net:21 HTTP/1.0
> Host: ftp.example.net:21
> (nil)Proxy-Connection: Keep-Alive
>

This (nil) obviously shouldn't be there. This is easily fixed with the patch:

--- http.c 3 Jul 2008 08:47:53 -0000 1.373
+++ http.c 10 Jul 2008 06:34:37 -0000
@@ -1292,7 +1292,7 @@
           proxyconn = "Proxy-Connection: Keep-Alive\r\n";
 
         if(!checkheaders(data, "User-Agent:") &&
- data->set.str[STRING_USERAGENT])
+ data->set.str[STRING_USERAGENT] && conn->allocptr.uagent)
           useragent = conn->allocptr.uagent;
 
         /* Send the connect request to the proxy */

But that could be papering over another problem, namely that curl probably
ought to be sending a User-Agent: string in this case, since it does so with
http transfers through a proxy tunnel.

>>> Dan

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