update to current API

This commit is contained in:
Sergio R. Caprile 2023-12-08 14:41:10 -03:00
parent c8105cffba
commit 2ba4a74762
4 changed files with 4 additions and 4 deletions

View File

@ -29,7 +29,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
// If s_url is https://, tell client connection to use TLS // If s_url is https://, tell client connection to use TLS
if (mg_url_is_ssl(s_url)) { if (mg_url_is_ssl(s_url)) {
struct mg_tls_opts opts = {.ca = s_ca, .srvname = host}; struct mg_tls_opts opts = {.ca = s_ca, .name = host};
mg_tls_init(c, &opts); mg_tls_init(c, &opts);
} }

View File

@ -13,7 +13,7 @@ static struct mg_connection *s_sntp_conn = NULL;
// Event handler for the listening HTTP/HTTPS connection. // Event handler for the listening HTTP/HTTPS connection.
static void wcb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) { static void wcb(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_ACCEPT && fn_data != NULL) { if (ev == MG_EV_ACCEPT && fn_data != NULL) {
struct mg_tls_opts opts = {.cert = s_ssl_cert, .certkey = s_ssl_key}; struct mg_tls_opts opts = {.cert = s_ssl_cert, .key = s_ssl_key};
mg_tls_init(c, &opts); mg_tls_init(c, &opts);
} else if (ev == MG_EV_HTTP_MSG) { } else if (ev == MG_EV_HTTP_MSG) {
struct mg_http_message *hm = ev_data; struct mg_http_message *hm = ev_data;

View File

@ -24,7 +24,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
MG_ERROR(("%p %s", c->fd, (char *) ev_data)); MG_ERROR(("%p %s", c->fd, (char *) ev_data));
} else if (ev == MG_EV_CONNECT) { } else if (ev == MG_EV_CONNECT) {
// Set up 2-way TLS that is required by AWS IoT // Set up 2-way TLS that is required by AWS IoT
struct mg_tls_opts opts = {.ca = s_ca, .cert = s_cert, .certkey = s_key}; struct mg_tls_opts opts = {.ca = s_ca, .cert = s_cert, .key = s_key};
mg_tls_init(c, &opts); mg_tls_init(c, &opts);
} else if (ev == MG_EV_MQTT_OPEN) { } else if (ev == MG_EV_MQTT_OPEN) {
// MQTT connect is successful // MQTT connect is successful

View File

@ -17,7 +17,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
if (ev == MG_EV_OPEN) { if (ev == MG_EV_OPEN) {
c->is_hexdumping = 1; c->is_hexdumping = 1;
} else if (ev == MG_EV_ACCEPT && fn_data != NULL) { } else if (ev == MG_EV_ACCEPT && fn_data != NULL) {
struct mg_tls_opts opts = {.cert = s_ssl_cert, .certkey = s_ssl_key}; struct mg_tls_opts opts = {.cert = s_ssl_cert, .key = s_ssl_key};
mg_tls_init(c, &opts); mg_tls_init(c, &opts);
} else if (ev == MG_EV_HTTP_MSG) { } else if (ev == MG_EV_HTTP_MSG) {
struct mg_http_message *hm = (struct mg_http_message *) ev_data; struct mg_http_message *hm = (struct mg_http_message *) ev_data;