lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] HTTP GET request only published on close connection


From: Bas Prins
Subject: [lwip-users] HTTP GET request only published on close connection
Date: Sat, 13 Jul 2024 11:06:39 +0200

Hi all,
We are using the http client app in lwip (src/apps/http/http_client.c).
In this source file
https://github.com/lwip-tcpip/lwip/blob/master/src/apps/http/http_client.c

There are two relevant events:
- line 350, here the receive function callback is called when data is received for the HTTP GET request
- line 304, here the connection is closed, which calls the result function callback, indicating the application that the HTTP GET request is finished.

This works fine, if the server we are calling to, is closing the tcp connection immediately after sending the result (200 OK). But, if the server keeps the connection open for a little while (in our case the server leaves the connection open for 5 seconds. then our application is delaying for 5 seconds.

Is there a reason for this? Wouldn't it make sense to check the HTTP RESULT on receiving the content of the HTTP GET request, and if this HTTP RESULT is already in an end state (typically 200 OK) that it would call recv_fn and result_fn immediately?

That solves our problem anyway, and now we have reliable and fast communication with any REST api.

Hoping for some insights.

Thanks a lot in advance

Best regards

Bas

reply via email to

[Prev in Thread] Current Thread [Next in Thread]