mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-29 02:40:47 +02:00
Apply proxy settings to Lua API sockets
This commit is contained in:
@@ -518,10 +518,6 @@ namespace http
|
|||||||
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_CONNECTTIMEOUT, curlConnectTimeoutS));
|
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_CONNECTTIMEOUT, curlConnectTimeoutS));
|
||||||
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_HTTPHEADER, handle->curlHeaders));
|
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_HTTPHEADER, handle->curlHeaders));
|
||||||
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_URL, handle->uri.c_str()));
|
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_URL, handle->uri.c_str()));
|
||||||
if (proxy.size())
|
|
||||||
{
|
|
||||||
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_PROXY, proxy.c_str()));
|
|
||||||
}
|
|
||||||
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_PRIVATE, (void *)handle));
|
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_PRIVATE, (void *)handle));
|
||||||
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_USERAGENT, userAgent.c_str()));
|
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_USERAGENT, userAgent.c_str()));
|
||||||
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_HEADERDATA, (void *)handle));
|
HandleCURLcode(curl_easy_setopt(handle->curlEasy, CURLOPT_HEADERDATA, (void *)handle));
|
||||||
@@ -615,8 +611,10 @@ namespace http
|
|||||||
HandleCURLcode(curl_easy_setopt(easy, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE));
|
HandleCURLcode(curl_easy_setopt(easy, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto &capath = http::RequestManager::Ref().Capath();
|
auto &rm = http::RequestManager::Ref();
|
||||||
auto &cafile = http::RequestManager::Ref().Cafile();
|
auto &capath = rm.Capath();
|
||||||
|
auto &cafile = rm.Cafile();
|
||||||
|
auto &proxy = rm.Proxy();
|
||||||
if (capath.size())
|
if (capath.size())
|
||||||
{
|
{
|
||||||
HandleCURLcode(curl_easy_setopt(easy, CURLOPT_CAPATH, capath.c_str()));
|
HandleCURLcode(curl_easy_setopt(easy, CURLOPT_CAPATH, capath.c_str()));
|
||||||
@@ -629,5 +627,9 @@ namespace http
|
|||||||
{
|
{
|
||||||
UseSystemCertProvider(easy);
|
UseSystemCertProvider(easy);
|
||||||
}
|
}
|
||||||
|
if (proxy.size())
|
||||||
|
{
|
||||||
|
HandleCURLcode(curl_easy_setopt(easy, CURLOPT_PROXY, proxy.c_str()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -99,6 +99,11 @@ namespace http
|
|||||||
return capath;
|
return capath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ByteString &Proxy() const
|
||||||
|
{
|
||||||
|
return proxy;
|
||||||
|
}
|
||||||
|
|
||||||
static RequestManagerPtr Create(ByteString newProxy, ByteString newCafile, ByteString newCapath, bool newDisableNetwork);
|
static RequestManagerPtr Create(ByteString newProxy, ByteString newCafile, ByteString newCapath, bool newDisableNetwork);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user