-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit f4f4bc6
WiFiClientSecure: robust TLS writes (loop & chunk), avoid zero-length write -> fixes sporadic MBEDTLS_ERR_NET_CONN_RESET (#11865)
* fix(ssl_client,wifi): Write full TLS buffer and avoid zero-length writes
Loop in send_ssl_data() until the entire buffer is written;
handle MBEDTLS_ERR_SSL_WANT_{READ,WRITE} and respect socket timeouts.
Return 0 for len==0 to prevent zero-length TLS writes.
Add a size==0 guard in WiFiClientSecure::write() for symmetry.
No API changes.
* fix(ssl_client): Chunk TLS writes and reset timeout after progress
Chunk TLS writes and reset timeout after progress to reduce mid-body resets
Send large TLS payloads in moderate chunks (4 KiB) instead of a single large write,
and measure the write timeout from the last successful progress. This significantly
reduces sporadic MBEDTLS_ERR_NET_CONN_RESET (-0x0050) observed during long HTTP bodies
(e.g., multipart uploads).
- write loop remains intact; now caps per-call size to 4096 bytes
- updates timeout window after each positive write to avoid false timeouts on slow links
- no API changes; handshake/verification paths unaffected
Sources
Ask ChatGPT
* refactor(ssl_client): Constexpr chunk size; rename max_write_chunk_size1 parent f49eb06 commit f4f4bc6
File tree
2 files changed
+27
-7
lines changed- libraries/NetworkClientSecure/src
2 files changed
+27
-7
lines changedLines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
227 | 227 |
| |
228 | 228 |
| |
229 | 229 |
| |
230 | + | ||
231 | + | ||
232 | + | ||
233 | + | ||
230 | 234 |
| |
231 | 235 |
| |
232 | 236 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
409 | 409 |
| |
410 | 410 |
| |
411 | 411 |
| |
412 | - | ||
413 | - | ||
412 | + | ||
413 | + | ||
414 | + | ||
415 | + | ||
416 | + | ||
417 | + | ||
418 | + | ||
419 | + | ||
420 | + | ||
421 | + | ||
422 | + | ||
423 | + | ||
424 | + | ||
414 | 425 |
| |
415 | - | ||
416 | - | ||
426 | + | ||
427 | + | ||
428 | + | ||
429 | + | ||
430 | + | ||
431 | + | ||
432 | + | ||
433 | + | ||
417 | 434 |
| |
418 | 435 |
| |
419 | 436 |
| |
420 | 437 |
| |
421 | 438 |
| |
422 | - | ||
439 | + | ||
423 | 440 |
| |
424 | 441 |
| |
425 | 442 |
| |
426 | - | ||
427 | 443 |
| |
428 | 444 |
| |
429 | 445 |
| |
430 | - | ||
446 | + | ||
431 | 447 |
| |
432 | 448 |
| |
433 | 449 |
| |
|
0 commit comments