[Web-SIG] start_response and error checking

Phillip J. Eby pje at telecommunity.com
Thu Sep 27 20:26:18 CEST 2007


At 12:54 PM 9/25/2007 +0200, Manlio Perillo wrote:
>The WSGI spec says that start_response callable *must not* actually
>transmit the response headers. Instead, it must store them.
>
>The problem is that it says nothing about errors checking.
>As an example the Apache mod_wsgi implementation only checks that the
>objects is a Python List Object.
>
>This means that I can do:
>
>start_response('200 OK', [1, 2, 3])
>
>with no exception being raised (the exception will only be raise when I
>attempt to write some data).
>
>Is this the intentend behaviour?

No.  start_response() *should* raise an error when given the bad 
data.  This should probably be fixed in the PEP.


>P.S.:
>I'm not sure, but it seems that Apache mod_wsgi allows status code with
>more then 3 digits, without reporting an error.
>Again, is this the intented, conforming, behaviour?

No.  It should be rejected.  In general, a WSGI server *should* 
reject bad input as soon as it receives it.

All that being said, these points are "shoulds" rather than 
"musts".  A good implementation should implement them.



More information about the Web-SIG mailing list