Commit ae312c98 authored by Ivan Vilata-i-Balaguer's avatar Ivan Vilata-i-Balaguer
Browse files

Use neutral IPv4/IPv6 parsing to catch network addrs in DoH.

parent 60bda690
......@@ -645,14 +645,11 @@ Client::State::resolve_tcp_doh( const std::string& host
if (!portn_o) return or_throw<TcpLookup>(yield, asio::error::invalid_argument);
// Build and return lookup if `host` is already a network address.
#define RETURN_IF_ADDR_V(IP_VERSION) \
{ \
sys::error_code e; \
auto addr = asio::ip::make_address_v##IP_VERSION(host, e); \
if (!e) return TcpLookup::create(TcpLookup::endpoint_type{move(addr), *portn_o}, host, port); \
}
RETURN_IF_ADDR_V(4);
RETURN_IF_ADDR_V(6);
{
sys::error_code e;
auto addr = asio::ip::make_address(host, e);
if (!e) return TcpLookup::create(TcpLookup::endpoint_type{move(addr), *portn_o}, host, port);
}
auto rq_o = doh::build_request(host, ep);
if (!rq_o) return or_throw<TcpLookup>(yield, asio::error::invalid_argument);
......
Supports Markdown
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