diff --git a/src/net/socket/client_socket_pool_manager.cc b/src/net/socket/client_socket_pool_manager.cc index 2ecf16d831..d72102a768 100644 --- a/src/net/socket/client_socket_pool_manager.cc +++ b/src/net/socket/client_socket_pool_manager.cc @@ -275,7 +275,7 @@ int InitSocketHandleForWebSocketRequest( std::move(callback), proxy_auth_callback); } -int InitSocketHandleForRawConnect2(const HostPortPair& endpoint, +int InitSocketHandleForRawConnect2(url::SchemeHostPort endpoint, HttpNetworkSession* session, int request_load_flags, RequestPriority request_priority, @@ -289,9 +289,8 @@ int InitSocketHandleForRawConnect2(const HostPortPair& endpoint, CompletionOnceCallback callback) { DCHECK(socket_handle); return InitSocketPoolHelper( - {"http", endpoint.HostForURL(), endpoint.port()}, request_load_flags, - request_priority, session, proxy_info, ssl_config_for_origin, - ssl_config_for_proxy, + std::move(endpoint), request_load_flags, request_priority, session, + proxy_info, ssl_config_for_origin, ssl_config_for_proxy, /*is_for_websockets=*/true, privacy_mode, std::move(network_isolation_key), SecureDnsPolicy::kDisable, SocketTag(), net_log, 0, socket_handle, HttpNetworkSession::NORMAL_SOCKET_POOL, diff --git a/src/net/socket/client_socket_pool_manager.h b/src/net/socket/client_socket_pool_manager.h index ba8772ac9d..f12c609c3d 100644 --- a/src/net/socket/client_socket_pool_manager.h +++ b/src/net/socket/client_socket_pool_manager.h @@ -126,7 +126,7 @@ int InitSocketHandleForWebSocketRequest( const ClientSocketPool::ProxyAuthCallback& proxy_auth_callback); NET_EXPORT int InitSocketHandleForRawConnect2( - const HostPortPair& endpoint, + url::SchemeHostPort endpoint, HttpNetworkSession* session, int request_load_flags, RequestPriority request_priority, diff --git a/src/net/tools/naive/naive_connection.cc b/src/net/tools/naive/naive_connection.cc index b7a703effb..ee9c68e842 100644 --- a/src/net/tools/naive/naive_connection.cc +++ b/src/net/tools/naive/naive_connection.cc @@ -19,6 +19,7 @@ #include "net/base/load_flags.h" #include "net/base/net_errors.h" #include "net/base/privacy_mode.h" +#include "net/base/url_util.h" #include "net/proxy_resolution/proxy_info.h" #include "net/socket/client_socket_handle.h" #include "net/socket/client_socket_pool_manager.h" @@ -27,6 +28,7 @@ #include "net/tools/naive/http_proxy_socket.h" #include "net/tools/naive/redirect_resolver.h" #include "net/tools/naive/socks5_server_socket.h" +#include "url/scheme_host_port.h" #if defined(OS_LINUX) #include @@ -243,8 +245,12 @@ int NaiveConnection::DoConnectServer() { #endif } - if (origin.IsEmpty()) { - LOG(ERROR) << "Connection " << id_ << " to invalid origin"; + url::CanonHostInfo host_info; + url::SchemeHostPort endpoint( + "http", CanonicalizeHost(origin.host(), &host_info), origin.port(), + url::SchemeHostPort::ALREADY_CANONICALIZED); + if (!endpoint.IsValid()) { + LOG(ERROR) << "Connection " << id_ << " to invalid origin " << origin.ToString(); return ERR_ADDRESS_INVALID; } @@ -252,7 +258,7 @@ int NaiveConnection::DoConnectServer() { // Ignores socket limit set by socket pool for this type of socket. return InitSocketHandleForRawConnect2( - origin, session_, LOAD_IGNORE_LIMITS, MAXIMUM_PRIORITY, proxy_info_, + std::move(endpoint), session_, LOAD_IGNORE_LIMITS, MAXIMUM_PRIORITY, proxy_info_, server_ssl_config_, proxy_ssl_config_, PRIVACY_MODE_DISABLED, network_isolation_key_, net_log_, server_socket_handle_.get(), io_callback_);