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
5abc3bc8
Commit
5abc3bc8
authored
Jul 01, 2020
by
Ivan Vilata-i-Balaguer
Browse files
Avoid DoH exchange if given host is already a network address.
parent
e8ee198a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/client.cpp
View file @
5abc3bc8
...
...
@@ -644,6 +644,18 @@ Client::State::resolve_tcp_doh( const std::string& host
auto
portn_o
=
parse
::
number
<
unsigned
short
>
(
portsv
);
if
(
!
portn_o
)
return
or_throw
<
TcpLookup
>
(
yield
,
asio
::
error
::
invalid_argument
);
// Build and return lookup if `host` is already a network address.
{
sys
::
error_code
e
;
auto
addr
=
asio
::
ip
::
make_address_v4
(
host
,
e
);
if
(
!
e
)
return
TcpLookup
::
create
(
TcpLookup
::
endpoint_type
{
move
(
addr
),
*
portn_o
},
host
,
port
);
}
{
sys
::
error_code
e
;
auto
addr
=
asio
::
ip
::
make_address_v6
(
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