Skip to content

Commit

Permalink
feat: use new envvar TR_CURL_PROXY_SSL_NO_VERIFY (#2622)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Pavlenko <andrey.a.pavlenko@gmail.com>
  • Loading branch information
ckerr and AndreyPavlenko committed Feb 14, 2022
1 parent 9f9b6cd commit 94c7208
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions libtransmission/web.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ struct tr_web
{
bool const curl_verbose = tr_env_key_exists("TR_CURL_VERBOSE");
bool const curl_ssl_verify = !tr_env_key_exists("TR_CURL_SSL_NO_VERIFY");
bool const curl_proxy_ssl_verify = !tr_env_key_exists("TR_CURL_PROXY_SSL_NO_VERIFY");

char* curl_ca_bundle;
int close_mode = ~0;

Expand Down Expand Up @@ -298,6 +300,19 @@ static CURL* createEasy(tr_session* s, struct tr_web* web, struct tr_web_task* t
curl_easy_setopt(e, CURLOPT_SSL_VERIFYPEER, 0L);
}

if (web->curl_proxy_ssl_verify)
{
if (web->curl_ca_bundle != NULL)
{
curl_easy_setopt(e, CURLOPT_PROXY_CAINFO, web->curl_ca_bundle);
}
}
else
{
curl_easy_setopt(e, CURLOPT_PROXY_SSL_VERIFYHOST, 0L);
curl_easy_setopt(e, CURLOPT_PROXY_SSL_VERIFYPEER, 0L);
}

curl_easy_setopt(e, CURLOPT_TIMEOUT, task->timeout_secs);
curl_easy_setopt(e, CURLOPT_URL, task->url().c_str());
curl_easy_setopt(e, CURLOPT_USERAGENT, TR_NAME "/" SHORT_VERSION_STRING);
Expand Down

0 comments on commit 94c7208

Please sign in to comment.