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
faeedb29
Commit
faeedb29
authored
Mar 18, 2015
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync main
parent
c8e8f94f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
mongoose.c
mongoose.c
+18
-7
No files found.
mongoose.c
View file @
faeedb29
...
@@ -699,8 +699,8 @@ static int ns_parse_address(const char *str, union socket_address *sa,
...
@@ -699,8 +699,8 @@ static int ns_parse_address(const char *str, union socket_address *sa,
sa
->
sin
.
sin_port
=
htons
((
uint16_t
)
port
);
sa
->
sin
.
sin_port
=
htons
((
uint16_t
)
port
);
}
}
if
(
*
use_ssl
&&
(
sscanf
(
str
+
len
,
":%99[^:
]:%99[^:
]%n"
,
cert
,
ca
,
&
n
)
==
2
||
if
(
*
use_ssl
&&
(
sscanf
(
str
+
len
,
":%99[^:
,]:%99[^:,
]%n"
,
cert
,
ca
,
&
n
)
==
2
||
sscanf
(
str
+
len
,
":%99[^:]%n"
,
cert
,
&
n
)
==
1
))
{
sscanf
(
str
+
len
,
":%99[^:
,
]%n"
,
cert
,
&
n
)
==
1
))
{
len
+=
n
;
len
+=
n
;
}
}
...
@@ -5134,20 +5134,31 @@ const char *mg_set_option(struct mg_server *server, const char *name,
...
@@ -5134,20 +5134,31 @@ const char *mg_set_option(struct mg_server *server, const char *name,
DBG
((
"%s [%s]"
,
name
,
*
v
));
DBG
((
"%s [%s]"
,
name
,
*
v
));
if
(
ind
==
LISTENING_PORT
)
{
if
(
ind
==
LISTENING_PORT
)
{
char
buf
[
500
]
=
""
;
size_t
n
=
0
;
struct
vec
vec
;
struct
vec
vec
;
/*
* Ports can be specified as 0, meaning that OS has to choose any
* free port that is available. In order to pass chosen port number to
* the user, we rewrite all 0 port to chosen values.
*/
while
((
value
=
next_option
(
value
,
&
vec
,
NULL
))
!=
NULL
)
{
while
((
value
=
next_option
(
value
,
&
vec
,
NULL
))
!=
NULL
)
{
struct
ns_connection
*
c
=
ns_bind
(
&
server
->
ns_mgr
,
vec
.
ptr
,
struct
ns_connection
*
c
=
ns_bind
(
&
server
->
ns_mgr
,
vec
.
ptr
,
mg_ev_handler
,
NULL
);
mg_ev_handler
,
NULL
);
if
(
c
==
NULL
)
{
if
(
c
==
NULL
)
{
error_msg
=
"Cannot bind to port"
;
error_msg
=
"Cannot bind to port"
;
break
;
break
;
}
else
{
}
else
{
char
buf
[
100
];
char
buf2
[
50
];
ns_sock_to_str
(
c
->
sock
,
buf
,
sizeof
(
buf
),
2
);
ns_sock_to_str
(
c
->
sock
,
buf2
,
sizeof
(
buf2
),
NS_FREE
(
*
v
);
memchr
(
vec
.
ptr
,
':'
,
vec
.
len
)
==
NULL
?
2
:
3
);
*
v
=
mg_strdup
(
buf
);
n
+=
snprintf
(
buf
+
n
,
sizeof
(
buf
)
-
n
,
"%s%s"
,
n
>
0
?
","
:
""
,
buf2
);
}
}
}
}
buf
[
sizeof
(
buf
)
-
1
]
=
'\0'
;
NS_FREE
(
*
v
);
*
v
=
mg_strdup
(
buf
);
#ifndef MONGOOSE_NO_FILESYSTEM
#ifndef MONGOOSE_NO_FILESYSTEM
}
else
if
(
ind
==
HEXDUMP_FILE
)
{
}
else
if
(
ind
==
HEXDUMP_FILE
)
{
server
->
ns_mgr
.
hexdump_file
=
*
v
;
server
->
ns_mgr
.
hexdump_file
=
*
v
;
...
...
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