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

Submitter:  Bas Prins <basprins1979>
Submitted:  Thu 17 Jun 2021 09:17:15 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  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>
Group administrator
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.

http://lwip.100.n7.nabble.com/httpc-get-file-doesn-t-seem-to-download-entire-file-td36496.html

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);
      pbuf_free(p);
    }
  }


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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

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
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    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.13-f8d8.
    Corresponding source code