http_client: reset timeout when receiving data

This fixes downloads longer than 15 seconds.
See bug #60787 (http_client does not reset timeout counter)

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
Bas Prins 2021-11-12 23:11:22 +01:00 committed by Simon Goldschmidt
parent a72fc743ef
commit a44fcb2e2e

View File

@ -337,6 +337,8 @@ httpc_tcp_recv(void *arg, struct altcp_pcb *pcb, struct pbuf *p, err_t r)
} }
if ((p != NULL) && (req->parse_state == HTTPC_PARSE_RX_DATA)) { if ((p != NULL) && (req->parse_state == HTTPC_PARSE_RX_DATA)) {
req->rx_content_len += p->tot_len; req->rx_content_len += p->tot_len;
/* received valid data: reset timeout */
req->timeout_ticks = HTTPC_POLL_TIMEOUT;
if (req->recv_fn != NULL) { if (req->recv_fn != NULL) {
/* directly return here: the connection might already be aborted from the callback! */ /* directly return here: the connection might already be aborted from the callback! */
return req->recv_fn(req->callback_arg, pcb, p, r); return req->recv_fn(req->callback_arg, pcb, p, r);