Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jenny Ryan
ouinet
Commits
ae312c98
Commit
ae312c98
authored
Jul 02, 2020
by
Ivan Vilata-i-Balaguer
Browse files
Use neutral IPv4/IPv6 parsing to catch network addrs in DoH.
parent
60bda690
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/client.cpp
View file @
ae312c98
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment