ProxyServer does no longer construct a HostPortPair manually from the ProxyServer::FromSchemeHostAndPort() method, but rely in a new utility functions instead, which explicitly used the host and ports and ignore the authentication information, if present. This change, along with some additional refactoring done around these classes, means we need to rework our override/patches to work in a slightly different way. This patch implementes the idea of (1) making sure that we don't bail out early when auth information is available, that (2) we get that information inserted in the HostPortPair that is used to created a ProxyServer, and (3) that we adapt the new utility function ProxyServerToProxyUri() to make sure it inserts the auth information, if present, in the string returned. Additionally, this also removes our own ParseAuthHostAndPort() function since we can just use url::ParseAuthority() instead. Chromium change: https://chromium.googlesource.com/chromium/src/+/e71c7f43d205a4a28f799ac4487c5942f496c7cb commit 5ccc3f0d4f3bb7d9b9caa93c266f3dbdfbf83205 Author: Eric Orth <ericorth@chromium.org> Date: Thu Sep 23 00:01:57 2021 +0000 Split ProxyServer PAC/URI conversion to a separate file No functional change. Helps simplify the ProxyServer class around its core purpose of representing proxy servers for net stack connections, which will make it easier to make upcoming refactors to both that and the separated-off conversion functionality. Bug: 1243398 commit 5dbd4599a981da1fac5dc5211772fe843a06a9b0 Author: Eric Orth <ericorth@chromium.org> Date: Fri Sep 24 21:21:24 2021 +0000 Stop dealing with HostPortPair in proxy_string_util.(cc/h) String->ProxyServer now done using ProxyServer::FromSchemeHostAndPort, and ProxyServer->String now done using ProxyServer::GetHost() and ProxyServer::GetPort(). With less ProxyServer-external dealing with HostPortPair, will aide the future-CL transition to not storing HostPortPair for all proxies. Also has the effect that construction-from-string now results in canonicalization of the ProxyServer hostname. Slight impact on tests that were parsing stuff with now-recognized-as-invalid hostnames (especially the v8 tracing tests that were hacking information into wildly invalid hostnames), but don't expect any real-world impact because these are clearly invalid names that shouldn't ever be able to resolve to real servers. Also moved the hostname:port parsing directly into proxy_string_util.cc (from url_util::ParseHostAndPort()) to avoid silliness like stripping IPv6 brackets just for them to be added back for canonicalization. Bug: 1243398
21 lines
1.0 KiB
Diff
21 lines
1.0 KiB
Diff
diff --git a/net/base/proxy_server.cc b/net/base/proxy_server.cc
|
|
index 3b09f37a48ab37290180053d9cf86af0f28a5433..14d052793f545c8596e45d38626255dac8c03ce9 100644
|
|
--- a/net/base/proxy_server.cc
|
|
+++ b/net/base/proxy_server.cc
|
|
@@ -60,6 +60,7 @@ ProxyServer ProxyServer::FromSchemeHostAndPort(Scheme scheme,
|
|
ProxyServer ProxyServer::FromSchemeHostAndPort(Scheme scheme,
|
|
base::StringPiece host,
|
|
absl::optional<uint16_t> port) {
|
|
+ BRAVE_PROXY_SERVER_FROM_SCHEME_HOST_AND_PORT_EXTRACT_AUTH_INFO
|
|
// Create INVALID proxies directly using `ProxyServer()`.
|
|
DCHECK_NE(scheme, SCHEME_INVALID);
|
|
|
|
@@ -96,6 +97,7 @@ ProxyServer ProxyServer::FromSchemeHostAndPort(Scheme scheme,
|
|
// A uint16_t port is always valid and canonicalized.
|
|
uint16_t fixed_port = port.value_or(GetDefaultPortForScheme(scheme));
|
|
|
|
+ BRAVE_PROXY_SERVER_FROM_SCHEME_HOST_AND_PORT_RETURN_HOST_PORT_PAIR
|
|
return ProxyServer(scheme, HostPortPair(unbracketed_host, fixed_port));
|
|
}
|
|
|