[Web-SIG] a possible error in the WSGI spec
Manlio Perillo
manlio_perillo at libero.it
Thu Dec 20 13:27:30 CET 2007
Hi.
It seems that there is a little error in the WSGI spec.
In the "Specification Details" chapter there is this note:
"""(Note: the application must invoke the start_response() callable
before the iterable yields its first body string, so that the server can
send the headers before any body content. However, this invocation may
be performed by the iterable's first iteration, so servers must not
assume that start_response() has been called before they begin iterating
over the iterable.)"""
What's wrong is that the invocation of start_response may be performed
at any iteration of the iterable, as long as the application yields
empty strings.
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"""
Manlio Perillo
More information about the Web-SIG
mailing list