From 40999f0056c44678d33f182154e17f9d0b143498 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Wed, 21 May 2025 10:34:22 +0200 Subject: [PATCH] Fix: failure to connect to a node if its domain resolves to an IPv6 address --- src/json_rpc_request.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/json_rpc_request.cpp b/src/json_rpc_request.cpp index d7caf4b..5a415ee 100644 --- a/src/json_rpc_request.cpp +++ b/src/json_rpc_request.cpp @@ -111,8 +111,10 @@ CurlContext::CurlContext(const std::string& address, int port, const std::string (void)ssl_fingerprint; #endif + const bool is_v6 = (address.find(':') != std::string::npos); + log::Stream s(buf); - s << protocol << address << ':' << port; + s << protocol << (is_v6 ? "[" : "") << address << (is_v6 ? "]:" : ":") << port; if (!m_req.empty() && (m_req.front() == '/')) { s << m_req.c_str() << '\0';