Files
Tasmota/lib
Adam Matthews ece53a64f8 AsyncHttpClientLight: end a body read when the server goes silent or closes (#25141)
* AsyncHttpClientLight: time out reading a body when the server goes silent

writeToStreamDataBlock() waited for the rest of a body for as long as
connected() held. A server that stops sending part way through without
closing leaves connected() true, so the worker never finishes and the
caller, waiting in runJob(), never returns. Give up after _tcpTimeout
without data and return HTTPC_ERROR_READ_TIMEOUT, as HttpClientLight
now does (#25139).

* AsyncHttpClientLight: notice when the server closes after the last byte

AsyncTcpAdapter only saw the peer close inside read(), and callers only
read when available() > 0. A body without Content-Length that ends with
the server closing left connected() true for ever, so
writeToStreamDataBlock() never returned. connected() now peeks at the
socket, as WiFiClient::connected() does: data still buffered keeps it
connected, an orderly close after it does not.

* AsyncHttpClientLight: address review of the read timeout

- connected() only reports a peer close and no longer calls stop(): it can
  be called from another task than the worker using the socket.
- writeToStreamDataBlock() closes the connection on a read timeout, as the
  chunked readers do, so a stalled connection is not reused.
- readBodyToStreamString(): the identity branch used by async GET/POST now
  times out after _tcpTimeout without data, and notices a close: with no
  Content-Length it ends the body, with one it is a lost connection.
2026-10-15 15:10:46 +02:00
..
2026-10-11 18:33:11 +02:00
2026-02-13 11:24:01 +01:00