refactor: set CURLOPT_MAXREDIRS once (#7233)

This commit is contained in:
Yat Ho
2024-11-07 04:36:34 +08:00
committed by GitHub
parent f1102f0b4d
commit 6bf62959b4

View File

@@ -522,7 +522,7 @@ public:
(void)curl_easy_setopt(e, CURLOPT_AUTOREFERER, 1L);
(void)curl_easy_setopt(e, CURLOPT_ACCEPT_ENCODING, "");
(void)curl_easy_setopt(e, CURLOPT_FOLLOWLOCATION, 1L);
(void)curl_easy_setopt(e, CURLOPT_MAXREDIRS, -1L);
(void)curl_easy_setopt(e, CURLOPT_MAXREDIRS, MaxRedirects);
(void)curl_easy_setopt(e, CURLOPT_NOSIGNAL, 1L);
(void)curl_easy_setopt(e, CURLOPT_PRIVATE, &task);
(void)curl_easy_setopt(e, CURLOPT_IPRESOLVE, task.ipProtocol());
@@ -576,7 +576,6 @@ public:
(void)curl_easy_setopt(e, CURLOPT_VERBOSE, curl_verbose ? 1L : 0L);
(void)curl_easy_setopt(e, CURLOPT_WRITEDATA, &task);
(void)curl_easy_setopt(e, CURLOPT_WRITEFUNCTION, &tr_web::Impl::onDataReceived);
(void)curl_easy_setopt(e, CURLOPT_MAXREDIRS, MaxRedirects);
if (auto const addrstr = task.bind_address(); addrstr)
{