Apply proxy settings to Lua API sockets

This commit is contained in:
Tamás Bálint Misius
2025-06-25 10:27:26 +02:00
parent 6e54da7a17
commit 61dfba1e80
2 changed files with 13 additions and 6 deletions

View File

@@ -518,10 +518,6 @@ namespace http
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_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_USERAGENT, userAgent.c_str()));
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));
#endif
auto &capath = http::RequestManager::Ref().Capath();
auto &cafile = http::RequestManager::Ref().Cafile();
auto &rm = http::RequestManager::Ref();
auto &capath = rm.Capath();
auto &cafile = rm.Cafile();
auto &proxy = rm.Proxy();
if (capath.size())
{
HandleCURLcode(curl_easy_setopt(easy, CURLOPT_CAPATH, capath.c_str()));
@@ -629,5 +627,9 @@ namespace http
{
UseSystemCertProvider(easy);
}
if (proxy.size())
{
HandleCURLcode(curl_easy_setopt(easy, CURLOPT_PROXY, proxy.c_str()));
}
}
}

View File

@@ -99,6 +99,11 @@ namespace http
return capath;
}
const ByteString &Proxy() const
{
return proxy;
}
static RequestManagerPtr Create(ByteString newProxy, ByteString newCafile, ByteString newCapath, bool newDisableNetwork);
};
}