curl-users
There is one bug for FTP over SOCKS4/5 proxy
Date: Thu, 28 Jun 2007 18:21:27 +0800
Daniel,
With the cURL's latest source code user still can not do FTP download via
SOCKS4/5 proxy server, when the proxy server is different from FTP server
(This is the most case) with command like "curl -v ftp://ftp_server
--socks5 socks_server -u user:passwd". Test case is successful just because
"ftp_server" and "socks_server" is occasionally the same (127.0.0.1) for
test environment.
Failure reason is because:
In the latest "ftp.c" line 1760:
switch(data->set.proxytype) {
case CURLPROXY_SOCKS5:
result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, newhost,
newport,
SECONDARYSOCKET, conn);
"newhost" is assigned its value at line 1670:
if (conn->bits.tunnel_proxy)
/* proxy tunnel -> use other host info because ip_addr_str is the
proxy address not the ftp host */
snprintf(newhost, sizeof(newhost), "%s", conn->host.name);
else
snprintf(newhost, sizeof(newhost), "%s", conn->ip_addr_str);
Here is the place where mistake happens because "conn->ip_addr_str" keeps ip
string for SOCKS_SERVER, not the address for FTP_SERVER. cURL is supposed to
connect with FTP_SERVER instead of SOCKS_SERVER after connection to proxy
has set up.
The variable "newhost" is not necessary to add in this case, just use
"conn->host.name" is okay.
Best Regards,
Ma Song
Received on 2007-06-28