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
0730590e
Commit
0730590e
authored
9 years ago
by
Sergey Lyubka
Committed by
Sergey Lyubka
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SSL codepath in restful_server example
PUBLISHED_FROM=4cd52839b8d2396f50f94f1ce36fa7b4501dc204
parent
f7e0b133
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
restful_server.c
examples/restful_server/restful_server.c
+14
-6
No files found.
examples/restful_server/restful_server.c
View file @
0730590e
...
...
@@ -51,6 +51,9 @@ int main(int argc, char *argv[]) {
struct
mg_connection
*
nc
;
int
i
;
char
*
cp
;
#ifdef NS_ENABLE_SSL
const
char
*
ssl_cert
=
NULL
;
#endif
mg_mgr_init
(
&
mgr
,
NULL
);
...
...
@@ -76,12 +79,7 @@ int main(int argc, char *argv[]) {
#endif
#ifdef NS_ENABLE_SSL
}
else
if
(
strcmp
(
argv
[
i
],
"-s"
)
==
0
&&
i
+
1
<
argc
)
{
const
char
*
ssl_cert
=
argv
[
++
i
];
const
char
*
err_str
=
mg_set_ssl
(
nc
,
ssl_cert
,
NULL
);
if
(
err_str
!=
NULL
)
{
fprintf
(
stderr
,
"Error loading SSL cert: %s
\n
"
,
err_str
);
exit
(
1
);
}
ssl_cert
=
argv
[
++
i
];
#endif
}
}
...
...
@@ -93,6 +91,16 @@ int main(int argc, char *argv[]) {
exit
(
1
);
}
#ifdef NS_ENABLE_SSL
if
(
ssl_cert
!=
NULL
)
{
const
char
*
err_str
=
mg_set_ssl
(
nc
,
ssl_cert
,
NULL
);
if
(
err_str
!=
NULL
)
{
fprintf
(
stderr
,
"Error loading SSL cert: %s
\n
"
,
err_str
);
exit
(
1
);
}
}
#endif
mg_set_protocol_http_websocket
(
nc
);
s_http_server_opts
.
document_root
=
"."
;
s_http_server_opts
.
enable_directory_listing
=
"yes"
;
...
...
This diff is collapsed.
Click to expand it.
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