Based on further discussion on curl-library, I reverted yesterday's SOCKS5

code to instead introduce support for a new proxy type called
CURLPROXY_SOCKS5_HOSTNAME that is used to send the host name to the proxy
instead of IP address and there's thus no longer any need for a new
curl_easy_setopt() option.

The default SOCKS5 proxy is again back to sending the IP address to the
proxy.  The new curl command line option for enabling sending host name to a
SOCKS5 proxy is now --socks5-hostname.
This commit is contained in:
Daniel Stenberg 2008-01-05 22:04:18 +00:00
parent 65008a4e55
commit b430576436
9 changed files with 35 additions and 47 deletions

View file

@ -480,8 +480,6 @@ struct Configurable {
bool raw;
bool post301;
bool nokeepalive;
bool socks5_resolve_local; /* don't use SOCKS5 proxy server to resolve
domain names */
struct OutStruct *outs;
};
@ -713,10 +711,10 @@ static void help(void)
" --retry-max-time <seconds> Retry only within this period",
" -s/--silent Silent mode. Don't output anything",
" -S/--show-error Show error. With -s, make curl show errors when they occur",
" --socks4 <host[:port]> Use SOCKS4 proxy on given host + port",
" --socks4a <host[:port]> Use SOCKS4a proxy on given host + port",
" --socks5 <host[:port]> Use SOCKS5 proxy and let the proxy resolve names",
" --socks5ip <host[:port]> Use SOCKS5 proxy on given host + port",
" --socks4 <host[:port]> SOCKS4 proxy on given host + port",
" --socks4a <host[:port]> SOCKS4a proxy on given host + port",
" --socks5-hostname <host[:port]> SOCKS5 proxy, pass name instead of IP",
" --socks5 <host[:port]> SOCKS5 proxy on given host + port",
" --stderr <file> Where to redirect stderr. - means stdout",
" -t/--telnet-option <OPT=val> Set telnet option",
" --trace <file> Write a debug trace to the given file",
@ -1906,11 +1904,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
free(config->ftpport);
config->ftpport = NULL;
break;
case 'c': /* --socks5ip specifies a socks5 proxy to use, but resolves
case 'c': /* --socks5 specifies a socks5 proxy to use, and resolves
the name locally and passes on the resolved address */
GetStr(&config->socksproxy, nextarg);
config->socksver = CURLPROXY_SOCKS5;
config->socks5_resolve_local = TRUE;
break;
case 't': /* --socks4 specifies a socks4 proxy to use */
GetStr(&config->socksproxy, nextarg);
@ -1920,11 +1917,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&config->socksproxy, nextarg);
config->socksver = CURLPROXY_SOCKS4A;
break;
case '2': /* --socks5 specifies a socks5 proxy and enables name resolving
with the proxy */
case '2': /* --socks5-hostname specifies a socks5 proxy and enables name
resolving with the proxy */
GetStr(&config->socksproxy, nextarg);
config->socksver = CURLPROXY_SOCKS5;
config->socks5_resolve_local = FALSE;
config->socksver = CURLPROXY_SOCKS5_HOSTNAME;
break;
case 'd': /* --tcp-nodelay option */
config->tcp_nodelay ^= TRUE;
@ -4511,10 +4507,6 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
if(config->socksproxy) {
my_setopt(curl, CURLOPT_PROXY, config->socksproxy);
my_setopt(curl, CURLOPT_PROXYTYPE, config->socksver);
if(config->socksver==CURLPROXY_SOCKS5)
/* added in 7.17.2 */
my_setopt(curl, CURLOPT_SOCKS5_RESOLVE_LOCAL,
config->socks5_resolve_local);
}
/* curl 7.13.0 */