Commit 17e51208 authored by Tricia Crichton's avatar Tricia Crichton Committed by Commit Bot

[ChromeDriver] Include both localhost addresses

For connections to localhost, ChromeDriver should test both IPv4 and
IPv6 formats to resolve issue where DevTools may not be listening on the
expected protocol.

Bug: chromedriver:3316, b/147285732
Change-Id: Iecbf8f4f1c8df6138fd8ef8d908217e760e13923
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013892Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Tricia Crichton <triciac@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734228}
parent 0fd0751e
......@@ -98,8 +98,16 @@ void WebSocket::Connect(net::CompletionOnceCallback callback) {
VLOG(0) << "resolved " << url_.HostNoBracketsPiece() << " to " << json;
}
if (url_.host() == "localhost") {
// ensure that both localhost addresses are included
// see https://bugs.chromium.org/p/chromedriver/issues/detail?id=3316
addresses.push_back(net::IPEndPoint(net::IPAddress::IPv4Localhost(), port));
addresses.push_back(net::IPEndPoint(net::IPAddress::IPv6Localhost(), port));
addresses.Deduplicate();
}
net::NetLogSource source;
socket_.reset(new net::TCPClientSocket(addresses, NULL, NULL, source));
socket_.reset(new net::TCPClientSocket(addresses, nullptr, nullptr, source));
state_ = CONNECTING;
connect_callback_ = std::move(callback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment