1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

curl: normal socks proxies still use CURLOPT_PROXY

... the newly introduced CURLOPT_SOCKS_PROXY is special and should be
asked for specially. (Needs new code.)

Unified proxy type to a single variable in the config struct.
This commit is contained in:
Daniel Stenberg 2016-12-16 15:34:14 +01:00
parent 7907a2bec9
commit 642398c651
3 changed files with 14 additions and 15 deletions

View File

@ -180,7 +180,7 @@ struct OperationConfig {
int ftp_ssl_ccc_mode;
char *socksproxy; /* set to server string */
int socksver; /* set to CURLPROXY_SOCKS* define */
int socks5_gssapi_nec; /* The NEC reference server does not protect the
encryption type exchange */
char *proxy_service_name; /* set authentication service name for HTTP and

View File

@ -799,21 +799,21 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
break;
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;
GetStr(&config->proxy, nextarg);
config->proxyver = CURLPROXY_SOCKS5;
break;
case 't': /* --socks4 specifies a socks4 proxy to use */
GetStr(&config->socksproxy, nextarg);
config->socksver = CURLPROXY_SOCKS4;
GetStr(&config->proxy, nextarg);
config->proxyver = CURLPROXY_SOCKS4;
break;
case 'T': /* --socks4a specifies a socks4a proxy to use */
GetStr(&config->socksproxy, nextarg);
config->socksver = CURLPROXY_SOCKS4A;
GetStr(&config->proxy, nextarg);
config->proxyver = CURLPROXY_SOCKS4A;
break;
case '2': /* --socks5-hostname specifies a socks5 proxy and enables name
resolving with the proxy */
GetStr(&config->socksproxy, nextarg);
config->socksver = CURLPROXY_SOCKS5_HOSTNAME;
GetStr(&config->proxy, nextarg);
config->proxyver = CURLPROXY_SOCKS5_HOSTNAME;
break;
case 'd': /* --tcp-nodelay option */
config->tcp_nodelay = toggle;

View File

@ -858,19 +858,18 @@ static CURLcode operate_do(struct GlobalConfig *global,
/* TODO: Make this a run-time check instead of compile-time one. */
my_setopt_str(curl, CURLOPT_PROXY, config->proxy);
/* new in libcurl 7.5 */
if(config->proxy)
my_setopt_enum(curl, CURLOPT_PROXYTYPE, config->proxyver);
my_setopt_str(curl, CURLOPT_PROXYUSERPWD, config->proxyuserpwd);
/* new in libcurl 7.3 */
my_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, config->proxytunnel?1L:0L);
/* new in libcurl 7.5 */
if(config->proxy)
my_setopt_enum(curl, CURLOPT_PROXYTYPE, (long)config->proxyver);
/* new in libcurl 7.52.0 */
if(config->socksproxy) {
if(config->socksproxy)
my_setopt_str(curl, CURLOPT_SOCKS_PROXY, config->socksproxy);
}
/* new in libcurl 7.10.6 */
if(config->proxyanyauth)