From ac9ebdfb1adbf0acfc023da8f1eb0e02b9ba75b4 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Tue, 28 Jul 2026 20:21:28 -0300 Subject: [PATCH] fix corner case --- mongoose.c | 1 + src/sock.c | 1 + 2 files changed, 2 insertions(+) diff --git a/mongoose.c b/mongoose.c index 603758a7..e1ce83cf 100644 --- a/mongoose.c +++ b/mongoose.c @@ -14500,6 +14500,7 @@ void mg_connect_resolved(struct mg_connection *c) { if (rc == 0) { // Success setlocaddr(FD(c), &c->loc); mg_call(c, MG_EV_CONNECT, NULL); // Send MG_EV_CONNECT to the user + if (c->is_tls_hs) mg_tls_handshake(c); if (!c->is_tls_hs) c->is_tls = 0; // user did not call mg_tls_init() } else if (MG_SOCK_PENDING(rc)) { // Need to wait for TCP handshake MG_DEBUG(("%lu %ld -> %M pend", c->id, c->fd, mg_print_ip_port, &c->rem)); diff --git a/src/sock.c b/src/sock.c index e7f9690d..c70c90bc 100644 --- a/src/sock.c +++ b/src/sock.c @@ -449,6 +449,7 @@ void mg_connect_resolved(struct mg_connection *c) { if (rc == 0) { // Success setlocaddr(FD(c), &c->loc); mg_call(c, MG_EV_CONNECT, NULL); // Send MG_EV_CONNECT to the user + if (c->is_tls_hs) mg_tls_handshake(c); if (!c->is_tls_hs) c->is_tls = 0; // user did not call mg_tls_init() } else if (MG_SOCK_PENDING(rc)) { // Need to wait for TCP handshake MG_DEBUG(("%lu %ld -> %M pend", c->id, c->fd, mg_print_ip_port, &c->rem));