Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
b5ed7ed7
Commit
b5ed7ed7
authored
Feb 05, 2012
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed NO_IPV6 to USE_IPV6. Also, using inet_ntop() everywhere.
parent
7af9df9f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
mongoose.c
mongoose.c
+4
-5
No files found.
mongoose.c
View file @
b5ed7ed7
...
...
@@ -369,7 +369,7 @@ static const char *month_names[] = {
union
usa
{
struct
sockaddr
sa
;
struct
sockaddr_in
sin
;
#if
!defined(NO
_IPV6)
#if
defined(USE
_IPV6)
struct
sockaddr_in6
sin6
;
#endif
};
...
...
@@ -509,13 +509,12 @@ const char *mg_get_option(const struct mg_context *ctx, const char *name) {
static
void
sockaddr_to_string
(
char
*
buf
,
size_t
len
,
const
union
usa
*
usa
)
{
buf
[
0
]
=
'\0'
;
#if
!defined(NO
_IPV6)
#if
defined(USE
_IPV6)
inet_ntop
(
usa
->
sa
.
sa_family
,
usa
->
sa
.
sa_family
==
AF_INET
?
(
void
*
)
&
usa
->
sin
.
sin_addr
:
(
void
*
)
&
usa
->
sin6
.
sin6_addr
,
buf
,
len
);
#else
// TODO(lsm): inet_ntoa is not thread safe, use inet_pton instead
strncpy
(
buf
,
inet_ntoa
(
usa
->
sin
.
sin_addr
),
len
);
inet_ntop
(
usa
->
sa
.
sa_family
,
(
void
*
)
&
usa
->
sin
.
sin_addr
,
buf
,
len
);
#endif
}
...
...
@@ -3434,7 +3433,7 @@ static int parse_port_string(const struct vec *vec, struct socket *so) {
}
so
->
is_ssl
=
vec
->
ptr
[
len
]
==
's'
;
#if
!defined(NO
_IPV6)
#if
defined(USE
_IPV6)
so
->
lsa
.
sin6
.
sin6_family
=
AF_INET6
;
so
->
lsa
.
sin6
.
sin6_port
=
htons
((
uint16_t
)
port
);
#else
...
...
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