On Tue, Jun 14, 2011 at 6:26 PM, Kazu Yamamoto
<kazu@iij.ad.jp> wrote:
Hello,
> I think the reason we didn't include the header is because, when I
> wrote it, I didn't know of a cross-platform way to get file sizes. Now
> that I know about unix-compat, this seems like a reasonable thing to
> add. Anyone know a reason we *shouldn't* do this?
For high performance web servers, system calls are the bottleneck.
So, Warp or its libraries should avoid unnecessary system calls.
Wai applications HAVE TO call a system call (stat()) to get file
information (for instance, modification time) and can get a file size
at the same time. So, they can add Content-Length: with one system
call.
There are 2 basic kinds of WAI apps- those for serving files that might change (a file server), and those that know exactly what files exist in advance (a web application). In the case of a web application, we can get all this information just once at compile time. For a file server, we could allow a configuration parameter for whether or not to do the system call. Of course, it is possible to mix these 2 use cases in one application, but that can be handled with multiple instances of wai-app-static.
If Warp or its libraries add Content-Length:, they need to call as
system call again. It gives really bad performance impact.
So, I support the current way of Warp.
--Kazu