[Web-SIG] WSGI 2.0

Ian Bicking ianb at colorstudy.com
Fri Mar 30 02:56:36 CEST 2007

Do we want to discuss WSGI 2.0?  I added a wiki page here to list 
anything anyone wants to discuss for 2.0: http://wsgi.org/wsgi/WSGI_2.0

I've listed the things I can remember, and copying here:

start_response and write

We could remove ``start_response`` and the writer that it implies.  This 
would lead to a signature like::

     def app(environ):
         return '200 OK', [('Content-type', 'text/plain')], ['Hello world']

That is, return a three-tuple of (status, headers, app_iter).

It's relatively simple to provide adapters to and from this signature to 
the WSGI 1.0 signature.

Optional keys (removing)

Several keys are optional in WSGI, but required in CGI, in particular 
``REMOTE_ADDR`` and ``SERVER_SOFTWARE`` are supposed to exist.

Unknown-length wsgi.input

There's no documented way to indicate that there *is* content in 
``environ['wsgi.input']``, but the content length is unknown.  A value 
of ``"-1"`` may work in many situations.  A missing ``CONTENT_LENGTH`` 
doesn't generally work currently (it's assumed to mean 0 by much code).


Currently the specification does not require servers to provide 
``environ['wsgi.input'].readline(size)`` (the size argument in 
particular).  But ``cgi.FieldStorage`` calls readline this way, so in 
effect it is required.

app_iter and threads

It's not clear if the app_iter must be used in the same thread as the 
application.  Since the application is blocking, presumably *it* must be 
run all in one thread.  This should be more explicitly documented.

Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
             | Write code, do good | http://topp.openplans.org/careers

More information about the Web-SIG mailing list