[Web-SIG] a possible error in the WSGI spec
Manlio Perillo
manlio_perillo at libero.it
Mon Dec 24 12:28:29 CET 2007
Phillip J. Eby ha scritto:
> [...]
>> There is also a little problem in the "The start_response() Callable"
>> chapter, in this phrase:
>>
>> """The start_response callable must not actually transmit the response
>> headers. Instead, it must store them for the server or gateway to
>> transmit only after the first iteration of the application return value
>> that yields a non-empty string, or upon the application's first
>> invocation of the write() callable"""
>>
>>
>> From this it seems that the response headers should be transmitted
>> after the first invocation of the write() callable, even if it returns
>> an empty string, but this is in contradiction with the following phrase:
>>
>> """In other words, response headers must not be sent until there is
>> actual body data available, or until the application's returned iterable
>> is exhausted"""
>
> There is no sane reason to call write() with an empty string, so I don't
> really see a conflict here.
>
Yes, there are no sane reasons, but it is still not explicitly forbidden.
> Please note that both write() and iteration in the normal case should be
> sending the entire response body in a single call or yield. Multiple
> yields or write() calls should ONLY be used when streaming output is
> *required*: i.e. server push or sending large files.
>
> (In addition, write() is intended strictly for legacy apps and
> frameworks only; new code should use iteration only, especially as WSGI
> 2 will drop the start_response() and write() functions altogether.)
>
>
By the way: isn't it better to first release a WSGI 1.1 before jumping
to a (incompatible) WSGI 2.0?
Manlio Perillo
More information about the Web-SIG
mailing list