buglwIP - A Lightweight TCP/IP stack - Bugs: bug #60787, http_client does not reset timeout...


You are not allowed to post comments on this tracker with your current authentication level.

bug #60787: http_client does not reset timeout counter

Submitted by:  Bas Prins <basprins1979>
Submitted on:  Thu 17 Jun 2021 09:17:15 AM UTC  
Category:  None Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Closed Planned Release:  2.2.0
lwIP version:  2.1.1

Fri 12 Nov 2021 10:12:00 PM UTC, comment #2: 

Fied, thanks for reporting!

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Tue 12 Oct 2021 03:16:43 AM UTC, comment #1: 

I encountered this as well, when downloading a large file with the client, but my solution was to set req->timeout_ticks before "if (req->parse_state != HTTPC_PARSE_RX_DATA)".  We should still update the timeout regardless of whether we're parsing headers or receiving the body.

Tom Collins <tomlogic>
Thu 17 Jun 2021 09:17:15 AM UTC, original submission:  

In this email thread we found that the http_client lacks resetting the timeout counter.


The fix I think could be easy, by simply adding one line in the httpc_tcp_recv function

  if ((p != NULL) && (req->parse_state == HTTPC_PARSE_RX_DATA)) {
    req->rx_content_len += p->tot_len;

    // ----- RESET TIMER TICKS HERE ------
    req->timeout_ticks = HTTPC_POLL_TIMEOUT;

    if (req->recv_fn != NULL) {
      /* directly return here: the connection migth already be aborted from the callback! */
      return req->recv_fn(req->callback_arg, pcb, p, r);
    } else {
      altcp_recved(pcb, p->tot_len);

In the thread some more optimizations are suggested. If it would be just the simple fix I would dare to make a pull request, but I am not confident enough to make things more configurable.

Bas Prins <basprins1979>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by tomlogic (Posted a comment)
  • -email is unavailable- added by basprins1979 (Submitted the item)
  • -email is unavailable- added by basprins1979

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-12 goldsimon StatusNone => Fixed
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed
        Planned ReleaseNone => 2.2.0
    2021-06-17 basprins1979 Carbon-Copy- => Added -email is unavailable-

    Back to the top

    Powered by Savane 3.7