lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [patch #9500] Avoid sending Content-Length header if data i


From: Giuseppe Modugno
Subject: [lwip-devel] [patch #9500] Avoid sending Content-Length header if data is not ready yet
Date: Mon, 5 Feb 2018 07:32:15 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36

Follow-up Comment #7, patch #9500 (project lwip):

> What's unclear to me is: why do you know a file exists (you return OK from
fs_open_custom), but don't know its size? Maybe 
> we would need some kind of delayed open mechanism instead... 

First of all, I'm talking about file with dynamic content, such as JSON data. 
Suppose the server receives a HTTP request from a client.  The request is
about data that the server doesn't know immediately.  It needs to retrive the
answer from another device, maybe connected through a RS485 bus.

We can't block fs_open() function until all data are received from the "slow"
serial bus.  So we immediately open the file, but without knowing the real
size.

Clearing persistent flag works, with the drawback to lost the persistent
connection, that is always a Good Thing.

Another possibility is to delay the content length calculation.  Actually the
Content Length header is generated and calculated in get_httpd_headers()
function (at the moment of fs_open), but it will be really sent during
http_send_headers().  If the file is not immediately ready (as in my example),
http_send_headers() will be delayed.

My suggestion is to postpone the calculation of Content Length header when
httpd really needs it, so when the header is really sent, that could be at a
later time.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?9500>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

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