[Web-SIG] Proposed specification: waiting for file descriptor events

Christopher Stawarz cstawarz at csail.mit.edu
Fri May 23 17:12:37 CEST 2008


On May 22, 2008, at 6:21 PM, Manlio Perillo wrote:

>> That way, the server doesn't have to rewrite the request, and the  
>> application doesn't need to know how to interpret the files.*  
>> parameters.
>
> How to interpret the files.* parameters is not really a problem.

It's a problem for a portable application, which will have to be able  
to parse both the original request and your server's rewritten version  
of it.

In any case, your request rewriting is compatible with my proposal.

> By the way: I see a problem with you API.
> What happens if an application do:
>
>    read, write, exc = m.fdset()
>
>    environ['x-wsgiorg.fdevent.readable'](read[0], 1.0)
>    environ['x-wsgiorg.fdevent.writable'](write[0], 1.0)
>
>    yield ''
>
> There is no way to know, when the application is resumed, if the  
> socket is ready for read or write.
>
> This probabily should not be a problem, but I'm not sure.

The result of doing this is undefined, and I've updated the spec to  
say so.  The application shouldn't do it, and the server should  
probably throw an error if it does.

>>>  In my implementation I return a function, but with generators in
>>>  Python 2.5 this can be done in a better way.
>> What advantage does this have over what I've proposed?
>
> You don't need to store a mutable variable in the environ.

I don't see any problem with a mutable environ variable, especially if  
it makes things simpler for server and application authors.  But if  
you want to do something fancier (like raising a Timeout exception in  
a Python 2.5 generator), then it's easy to write a wrapper that does so.


Chris


More information about the Web-SIG mailing list