[Web-SIG] Returned application object and fileno.

Andrew Eland andrew at andreweland.org
Wed Sep 1 13:30:47 CEST 2004


Alan Kennedy wrote:

> Hmm, I'm not sure I understand what you are saying here Andrew. 
> The use-case we're trying to cover is where the application wants to 
> return a file-like object to the WSGI server/framework. The applications 
> intention should be that the contents of the file-like object, from the 
> current file-pointer onwards, should be transferred to the return socket 
> for the HTTP request.

The intent, I think, is to special-case the sending of static files, 
allowing a server to use the most efficient method of transferring data 
from a file to a socket that the platform provides.

Under CPython, the server could use something like sendfile() or epoll() 
  to transfer data, if it has access to the underlying file descriptor.
Under Jython, with a server written in Java, it would be nice to allow 
the use the most efficient Java mechanism to transfer data from the file 
to the client, which I guess is the functionality under java.nio. To do 
this, the server would need to access the underlying Java object 
representing the file, a java.nio.Channel or similar.

   -- Andrew (http://www.andreweland.org)


More information about the Web-SIG mailing list