From ffeed0b29802118fddbf75a334bb32888a2363da Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Wed, 6 Mar 2024 18:10:52 +0100 Subject: Remove dead code for host replacement --- src/other_tools/utils/curl_url_handle.cpp | 46 ------------------------------- 1 file changed, 46 deletions(-) (limited to 'src/other_tools/utils/curl_url_handle.cpp') diff --git a/src/other_tools/utils/curl_url_handle.cpp b/src/other_tools/utils/curl_url_handle.cpp index 33390ea6..27898299 100644 --- a/src/other_tools/utils/curl_url_handle.cpp +++ b/src/other_tools/utils/curl_url_handle.cpp @@ -790,52 +790,6 @@ auto CurlURLHandle::NoproxyStringMatches(std::string const& no_proxy) noexcept } } -auto CurlURLHandle::ReplaceHostname(std::string const& url, - std::string const& hostname) noexcept - -> std::optional { - try { - // We should not guess the scheme based on current hostname, as it may - // cause the URL with the new hostname to falsely fail; we set - // use_default_scheme instead. Additionally, we set use_no_authority to - // false as the given URL MUST already have a hostname to be replaced. - if (auto parsed_url = CreatePermissive(url, - false /*use_guess_scheme*/, - true /*use_default_scheme*/, - true /*use_non_support_scheme*/, - false /*use_no_authority*/, - true /*use_path_as_is*/, - true /*use_allow_space*/, - true /*ignore_fatal*/)) { - if (*parsed_url == nullptr) { - return std::nullopt; - } - auto rc = curl_url_set(parsed_url.value()->handle_.get(), - CURLUPART_HOST, - hostname.c_str(), - 0U); - if (rc != CURLUE_OK) { - Logger::Log(LogLevel::Debug, - "CurlURLHandle: setting hostname {} in URL {} " - "failed with:\n{}", - hostname, - url, - curl_url_strerror(rc)); - return std::nullopt; - } - return parsed_url.value()->GetURL(false /*use_default_port*/, - true /*use_default_scheme*/, - false /*use_no_default_port*/, - true /*ignore_fatal*/); - } - } catch (std::exception const& ex) { - Logger::Log(LogLevel::Debug, - "CurlURLHandle: Replacing URL hostname failed unexpectedly " - "with:\n{}", - ex.what()); - } - return std::nullopt; -} - auto CurlURLHandle::GetHostname(std::string const& url) noexcept -> std::optional { try { -- cgit v1.2.3