| 206 | } |
| 207 | |
| 208 | bool SFTPClient::setProxy(ProxyType type, const utils::HTTPProxy& proxy) { |
| 209 | switch (type) { |
| 210 | case ProxyType::Http: |
| 211 | if (curl_easy_setopt(easy_, CURLOPT_PROXYTYPE, CURLPROXY_HTTP) != CURLE_OK) { |
| 212 | return false; |
| 213 | } |
| 214 | if (curl_easy_setopt(easy_, CURLOPT_HTTPPROXYTUNNEL, 1L) != CURLE_OK) { |
| 215 | return false; |
| 216 | } |
| 217 | break; |
| 218 | case ProxyType::Socks: |
| 219 | if (curl_easy_setopt(easy_, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5) != CURLE_OK) { |
| 220 | return false; |
| 221 | } |
| 222 | break; |
| 223 | } |
| 224 | std::stringstream proxy_string; |
| 225 | proxy_string << proxy.host << ":" << proxy.port; |
| 226 | if (curl_easy_setopt(easy_, CURLOPT_PROXY, proxy_string.str().c_str()) != CURLE_OK) { |
| 227 | return false; |
| 228 | } |
| 229 | return true; |
| 230 | } |
| 231 | |
| 232 | bool SFTPClient::setConnectionTimeout(int64_t timeout) { |
| 233 | return curl_easy_setopt(easy_, CURLOPT_CONNECTTIMEOUT_MS, timeout) == CURLE_OK; |
no test coverage detected