Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
026ab797
Commit
026ab797
authored
Sep 07, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: util::numeric_host: Use inet_pton instead of getaddrinfo
parent
79945c0c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
src/util.cc
src/util.cc
+7
-10
No files found.
src/util.cc
View file @
026ab797
...
@@ -636,19 +636,16 @@ void write_uri_field(std::ostream &o, const char *uri, const http_parser_url &u,
...
@@ -636,19 +636,16 @@ void write_uri_field(std::ostream &o, const char *uri, const http_parser_url &u,
}
}
bool
numeric_host
(
const
char
*
hostname
)
{
bool
numeric_host
(
const
char
*
hostname
)
{
return
numeric_host
(
hostname
,
AF_
UNSPEC
);
return
numeric_host
(
hostname
,
AF_
INET
)
||
numeric_host
(
hostname
,
AF_INET6
);
}
}
bool
numeric_host
(
const
char
*
hostname
,
int
family
)
{
bool
numeric_host
(
const
char
*
hostname
,
int
family
)
{
struct
addrinfo
*
res
;
int
rv
;
struct
addrinfo
hints
{};
std
::
array
<
uint8_t
,
sizeof
(
struct
in6_addr
)
>
dst
;
hints
.
ai_family
=
family
;
hints
.
ai_flags
=
AI_NUMERICHOST
;
rv
=
inet_pton
(
family
,
hostname
,
dst
.
data
());
if
(
getaddrinfo
(
hostname
,
nullptr
,
&
hints
,
&
res
))
{
return
false
;
return
rv
==
1
;
}
freeaddrinfo
(
res
);
return
true
;
}
}
std
::
string
numeric_name
(
const
struct
sockaddr
*
sa
,
socklen_t
salen
)
{
std
::
string
numeric_name
(
const
struct
sockaddr
*
sa
,
socklen_t
salen
)
{
...
...
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