Curl:CURLOPT_REDIR_PROTOCOLS(_STR): use only "https", not "http"

Change-Id: If615503b598f6823d7978f12e666832c82b63ece
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145334
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
Julien Nabet 2023-01-11 11:28:27 +01:00 committed by Michael Stahl
parent 432aefa738
commit e78859005b
2 changed files with 6 additions and 6 deletions

View file

@ -562,11 +562,11 @@ std::string download_content(const OString& rURL, bool bFile, OUString& rHash)
headerlist = curl_slist_append(headerlist, buf);
curl_easy_setopt(curl.get(), CURLOPT_HTTPHEADER, headerlist);
curl_easy_setopt(curl.get(), CURLOPT_FOLLOWLOCATION, 1); // follow redirects
// only allow redirect to http:// and https://
// only allow redirect to https://
#if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 85)
curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS_STR, "https");
#else
curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
curl_easy_setopt(curl.get(), CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
#endif
std::string response_body;

View file

@ -232,11 +232,11 @@ static bool curl_run(std::u16string_view rURL, OutData& out, const OString& aPro
// enable redirection
(void)curl_easy_setopt(pCURL, CURLOPT_FOLLOWLOCATION, 1);
// only allow redirect to http:// and https://
// only allow redirect to https://
#if (LIBCURL_VERSION_MAJOR > 7) || (LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 85)
curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "http,https");
curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS_STR, "https");
#else
curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
curl_easy_setopt(pCURL, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTPS);
#endif
// write function