fix: workaround HSTS upgrading to HTTPS for HTTP trackers (#5969)
This commit is contained in:
parent
bcab17f963
commit
4bb205d440
|
@ -166,7 +166,7 @@ public:
|
||||||
curl_ca_bundle = std::move(bundle);
|
curl_ca_bundle = std::move(bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
shareEverything();
|
share_setopt();
|
||||||
|
|
||||||
if (curl_ssl_verify)
|
if (curl_ssl_verify)
|
||||||
{
|
{
|
||||||
|
@ -757,24 +757,23 @@ public:
|
||||||
return curlsh_.get();
|
return curlsh_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void shareEverything()
|
void share_setopt()
|
||||||
{
|
{
|
||||||
// Tell curl to share whatever it can.
|
// Do *not* share HSTS cache
|
||||||
// https://curl.se/libcurl/c/CURLSHOPT_SHARE.html
|
// https://github.com/transmission/transmission/issues/5199
|
||||||
//
|
|
||||||
// The user's system probably has a different version of curl than
|
|
||||||
// we're compiling with; so instead of listing fields by name, just
|
|
||||||
// loop until curl says we've exhausted the list.
|
|
||||||
|
|
||||||
auto* const sh = shared();
|
auto* const sh = shared();
|
||||||
for (long type = CURL_LOCK_DATA_COOKIE;; ++type)
|
curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_COOKIE);
|
||||||
{
|
curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);
|
||||||
if (curl_share_setopt(sh, CURLSHOPT_SHARE, type) != CURLSHE_OK)
|
#if LIBCURL_VERSION_NUM >= 0x071700 /* 7.23.0 */
|
||||||
{
|
curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
|
||||||
tr_logAddDebug(fmt::format("CURLOPT_SHARE ended at {}", type));
|
#endif
|
||||||
return;
|
#if LIBCURL_VERSION_NUM >= 0x073900 /* 7.57.0 */
|
||||||
}
|
curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
|
||||||
}
|
#endif
|
||||||
|
#if LIBCURL_VERSION_NUM >= 0x073D00 /* 7.61.0 */
|
||||||
|
curl_share_setopt(sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_PSL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline auto curl_init_flag = std::once_flag{};
|
static inline auto curl_init_flag = std::once_flag{};
|
||||||
|
|
Loading…
Reference in New Issue