1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-07-29 21:01:13 +03:00

Add HTTPS support to embedded example

This commit is contained in:
bel
2015-11-17 22:03:19 +01:00
parent 183e96bed9
commit 851a4cda6b

View File

@ -18,11 +18,19 @@
#define DOCUMENT_ROOT "."
#ifdef NO_SSL
#ifdef USE_IPV6
#define PORT "[::]:8888"
#else
#define PORT "8888"
#endif
#else
#ifdef USE_IPV6
#define PORT "[::]:8888r,[::]:8843s"
#else
#define PORT "8888r,8843s"
#endif
#endif
#define EXAMPLE_URI "/example"
#define EXIT_URI "/exit"
int exitNow = 0;
@ -319,6 +327,10 @@ main(int argc, char *argv[])
#ifdef USE_WEBSOCKET
"websocket_timeout_ms",
"3600000",
#endif
#ifndef NO_SSL
"ssl_certificate",
"../../resources/cert/server.pem",
#endif
0};
struct mg_callbacks callbacks;
@ -344,7 +356,14 @@ main(int argc, char *argv[])
err = 1;
}
#endif
#ifndef NO_SSL
if (!mg_check_feature(2)) {
fprintf(stderr,
"Error: Embedded example built with SSL support, "
"but civetweb library build without.\n");
err = 1;
}
#endif
if (err) {
fprintf(stderr, "Cannot start CivetWeb - inconsistent build.\n");
return EXIT_FAILURE;