mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
set is_tls at mg_listen and mg_connect level
This commit is contained in:
1 parent
29594283c1
commit
b740c80855
25 files changed
+69
-49
No files matched your search
@@ -13,7 +13,7 @@ static struct mg_connection *s_sntp_conn = NULL;
|
||||
|
||||
// Event handler for the listening HTTP/HTTPS connection.
|
||||
static void wcb(struct mg_connection *c, int ev, void *ev_data) {
|
||||
if (ev == MG_EV_ACCEPT && c->fn_data != NULL) {
|
||||
if (ev == MG_EV_ACCEPT && c->is_tls) {
|
||||
struct mg_tls_opts opts = {.cert = (char *) s_ssl_cert, .key = (char *) s_ssl_key};
|
||||
mg_tls_init(c, &opts);
|
||||
} else if (ev == MG_EV_HTTP_MSG) {
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char *argv[]) {
|
||||
mg_mgr_init(&mgr);
|
||||
mg_log_set(MG_LL_DEBUG);
|
||||
mg_http_listen(&mgr, s_http_addr, wcb, NULL);
|
||||
mg_http_listen(&mgr, s_https_addr, wcb, &mgr);
|
||||
mg_http_listen(&mgr, s_https_addr, wcb, NULL);
|
||||
|
||||
mg_timer_add(&mgr, 5000, MG_TIMER_REPEAT | MG_TIMER_RUN_NOW, timer_fn, &mgr);
|
||||
|
||||
|
||||
Reference in new issue
Block a user