lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] How to use LWIP_HTTPD_FS_ASYNC_READ


From: Giuseppe Modugno
Subject: Re: [lwip-users] How to use LWIP_HTTPD_FS_ASYNC_READ
Date: Mon, 27 Nov 2017 09:52:43 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Il 24/11/2017 16:43, goldsimon ha scritto:
You're right in that it doesn't work. The browser has no way to know the body size.
The downside of not sending conten length is that the server will have to close the connection. Reopening it might take longer than just sending zero bytes to create the correct content size...
Why the server should close the connection when the Content Length header is not send? I tried and it seems it works well:



Server is 192.168.1.201, client is 151.45.118.38. The request is GET log.cgi?first=0&num=8 (packet n. 57). The answer is at the selected packet (n. 74). As you can see, the server doesn't send Content-Length header (I made some modifications on httpd.c) and the body (JSON data) is included in the same TCP session.

Of course the client couldn't know the length of data in advance, but this isn't a problem for me. They aren't too big, the only issue is that they aren't available when the headers are generated. Indeed, get_http_headers() function is called from http_init_file(), IMHO too early. A small improvement could be to call get_http_headers() when at least the first block of data is available. In my case, I have only a single block of data, so I could send the correct Content-Length header. I will add this request on savannah.

Anyway, at least for the moment, the solution to avoid sending Content-Length is ok for me.

reply via email to

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