Преглед изворни кода

support all socks-proxy known to curl in https method

David Kalnischkies пре 10 година
родитељ
комит
d415fc795a
1 измењених фајлова са 12 додато и 1 уклоњено
  1. 12 1
      methods/https.cc

+ 12 - 1
methods/https.cc

@@ -205,9 +205,20 @@ void HttpsMethod::SetupProxy()						/*{{{*/
    }
    }
 
 
    // Determine what host and port to use based on the proxy settings
    // Determine what host and port to use based on the proxy settings
-   if (UseProxy.empty() == false) 
+   if (UseProxy.empty() == false)
    {
    {
       Proxy = UseProxy;
       Proxy = UseProxy;
+      if (Proxy.Access == "socks5h")
+	 curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
+      else if (Proxy.Access == "socks5")
+	 curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
+      else if (Proxy.Access == "socks4a")
+	 curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
+      else if (Proxy.Access == "socks")
+	 curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
+      else
+	 curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
+
       if (Proxy.Port != 1)
       if (Proxy.Port != 1)
 	 curl_easy_setopt(curl, CURLOPT_PROXYPORT, Proxy.Port);
 	 curl_easy_setopt(curl, CURLOPT_PROXYPORT, Proxy.Port);
       curl_easy_setopt(curl, CURLOPT_PROXY, Proxy.Host.c_str());
       curl_easy_setopt(curl, CURLOPT_PROXY, Proxy.Host.c_str());