]> granicus.if.org Git - curl/commitdiff
curl: normal socks proxies still use CURLOPT_PROXY
authorDaniel Stenberg <daniel@haxx.se>
Fri, 16 Dec 2016 14:34:14 +0000 (15:34 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 16 Dec 2016 14:34:14 +0000 (15:34 +0100)
... 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.

src/tool_cfgable.h
src/tool_getparam.c
src/tool_operate.c

index 6589d8824ec44c270a961ff980a7892b28ce6e4b..30749ffff48bb0db1e5c3e243c3eada3740b786f 100644 (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
index 9b5c9a54c1142522a2b6a253767e620fa4eefa87..f94a2b629f34ca352c4042bd165027dc549b4cb6 100644 (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;
index 504c20769c877ff903460ddefb70393f31122a01..9fc03b43bcee38e3321dbd47ecbf401b0372d095 100644 (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)