mirror of
https://github.com/lammertb/libhttp.git
synced 2025-07-31 08:24:23 +03:00
Add HTTPS support to embedded example
This commit is contained in:
@ -18,11 +18,19 @@
|
|||||||
|
|
||||||
|
|
||||||
#define DOCUMENT_ROOT "."
|
#define DOCUMENT_ROOT "."
|
||||||
|
#ifdef NO_SSL
|
||||||
#ifdef USE_IPV6
|
#ifdef USE_IPV6
|
||||||
#define PORT "[::]:8888"
|
#define PORT "[::]:8888"
|
||||||
#else
|
#else
|
||||||
#define PORT "8888"
|
#define PORT "8888"
|
||||||
#endif
|
#endif
|
||||||
|
#else
|
||||||
|
#ifdef USE_IPV6
|
||||||
|
#define PORT "[::]:8888r,[::]:8843s"
|
||||||
|
#else
|
||||||
|
#define PORT "8888r,8843s"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#define EXAMPLE_URI "/example"
|
#define EXAMPLE_URI "/example"
|
||||||
#define EXIT_URI "/exit"
|
#define EXIT_URI "/exit"
|
||||||
int exitNow = 0;
|
int exitNow = 0;
|
||||||
@ -319,6 +327,10 @@ main(int argc, char *argv[])
|
|||||||
#ifdef USE_WEBSOCKET
|
#ifdef USE_WEBSOCKET
|
||||||
"websocket_timeout_ms",
|
"websocket_timeout_ms",
|
||||||
"3600000",
|
"3600000",
|
||||||
|
#endif
|
||||||
|
#ifndef NO_SSL
|
||||||
|
"ssl_certificate",
|
||||||
|
"../../resources/cert/server.pem",
|
||||||
#endif
|
#endif
|
||||||
0};
|
0};
|
||||||
struct mg_callbacks callbacks;
|
struct mg_callbacks callbacks;
|
||||||
@ -344,7 +356,14 @@ main(int argc, char *argv[])
|
|||||||
err = 1;
|
err = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#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) {
|
if (err) {
|
||||||
fprintf(stderr, "Cannot start CivetWeb - inconsistent build.\n");
|
fprintf(stderr, "Cannot start CivetWeb - inconsistent build.\n");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
Reference in New Issue
Block a user