Fix not reading last TLS small record with fast closure

Fixes #3104
MbedTLS API fairplay
This commit is contained in:
Sergio R. Caprile committed 2025-04-22 09:56:49 -03:00
1 parent 3861e2e1e7
commit 8e0212c3db
4 files changed
+15 -7

No files matched your search

+5 -1
View File
@@ -200,7 +200,11 @@ long mg_tls_send(struct mg_connection *c, const void *buf, size_t len) {
c->is_tls_throttled =
(n == MBEDTLS_ERR_SSL_WANT_READ || n == MBEDTLS_ERR_SSL_WANT_WRITE);
if (was_throttled) return MG_IO_WAIT; // flushed throttled data instead
if (c->is_tls_throttled) return len; // already encripted that when throttled
if (c->is_tls_throttled) {
tls->throttled_buf = (unsigned char *)buf; // MbedTLS code actually ignores
tls->throttled_len = len; // these, but let's play API rules
return (long) len; // already encripted that when throttled
}
if (n <= 0) return MG_IO_ERR;
return n;
}