fix WolfSSL not working on built-in TCP/IP

This commit is contained in:
Sergio R. Caprile committed 2026-07-28 12:12:33 -03:00
1 parent 2db7119080
commit 6b8d8b5caa
3 files changed
+32 -6

No files matched your search

+6 -1
View File
@@ -315,7 +315,12 @@ size_t mg_tls_pending(struct mg_connection *c) {
long mg_tls_recv(struct mg_connection *c, void *buf, size_t len) {
struct mg_tls *tls = (struct mg_tls *) c->tls;
int n = SSL_read(tls->ssl, buf, (int) len);
int n;
#if MG_TLS == MG_TLS_WOLFSSL
uint8_t dummy; // WolfSSL requires destination != NULL
if (buf == NULL && len == 0) buf = &dummy;
#endif
n = SSL_read(tls->ssl, buf, (int) len);
if (!c->is_tls_hs && (buf == NULL || len == 0) && n == 0) return 0; // MIP
if (n < 0 && mg_tls_err(c, tls, n) == 0) return MG_IO_WAIT;
if (n <= 0) return MG_IO_ERR;