AU: remove obsolete proxy resolver code
The module chrome_proxy_resolver has been long obsoleted by
chrome_browser_proxy_resolver, only that it kept living in our codebase,
if only for the use of a single static method, which had nothing to do
with proxy resolution and in fact is Curl specific. This CL removes it
along with its build/execution dependencies.
BUG=chromium:208655
TEST=Builds fine and unit tests running
Change-Id: Iff50c2c75451e5f3ddbc27c5a90a8b1a421a5d8d
Reviewed-on: https://gerrit.chromium.org/gerrit/63147
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/libcurl_http_fetcher.cc b/libcurl_http_fetcher.cc
index 7d82462..c095504 100644
--- a/libcurl_http_fetcher.cc
+++ b/libcurl_http_fetcher.cc
@@ -12,7 +12,6 @@
#include <base/stringprintf.h>
#include "update_engine/certificate_checker.h"
-#include "update_engine/chrome_proxy_resolver.h"
#include "update_engine/dbus_interface.h"
#include "update_engine/utils.h"
@@ -59,6 +58,30 @@
return force_build_type_ ? forced_official_build_ : utils::IsOfficialBuild();
}
+bool LibcurlHttpFetcher::GetProxyType(const std::string& proxy,
+ curl_proxytype* out_type) {
+ if (utils::StringHasPrefix(proxy, "socks5://") ||
+ utils::StringHasPrefix(proxy, "socks://")) {
+ *out_type = CURLPROXY_SOCKS5_HOSTNAME;
+ return true;
+ }
+ if (utils::StringHasPrefix(proxy, "socks4://")) {
+ *out_type = CURLPROXY_SOCKS4A;
+ return true;
+ }
+ if (utils::StringHasPrefix(proxy, "http://") ||
+ utils::StringHasPrefix(proxy, "https://")) {
+ *out_type = CURLPROXY_HTTP;
+ return true;
+ }
+ if (utils::StringHasPrefix(proxy, kNoProxy)) {
+ // known failure case. don't log.
+ return false;
+ }
+ LOG(INFO) << "Unknown proxy type: " << proxy;
+ return false;
+}
+
void LibcurlHttpFetcher::ResumeTransfer(const std::string& url) {
LOG(INFO) << "Starting/Resuming transfer";
CHECK(!transfer_in_progress_);
@@ -82,7 +105,7 @@
GetCurrentProxy().c_str()), CURLE_OK);
// Curl seems to require us to set the protocol
curl_proxytype type;
- if (ChromeProxyResolver::GetProxyType(GetCurrentProxy(), &type)) {
+ if (GetProxyType(GetCurrentProxy(), &type)) {
CHECK_EQ(curl_easy_setopt(curl_handle_,
CURLOPT_PROXYTYPE,
type), CURLE_OK);