Commit 642398c6 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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.
parent 7907a2be
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+8 −8
Original line number Diff line number Diff line
@@ -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;
+5 −6
Original line number Diff line number Diff line
@@ -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)