[Web-SIG] WSGI in standard library
Clark C. Evans
cce at clarkevans.com
Wed Feb 15 17:22:18 CET 2006
On Wed, Feb 15, 2006 at 08:39:03AM -0500, Jean-Paul Calderone wrote:
| On Wed, 15 Feb 2006 00:50:11 -0500, "Clark C. Evans" <cce at clarkevans.com> wrote:
| >On Mon, Feb 13, 2006 at 12:49:00PM -0800, Guido van Rossum wrote:
| >| My gut feeling: Ignores many parts of the WSGI spec (sendfile, strict
| >| error checking), supports unnecessary stuff for stdlib, i.e. Continue
| >| support, HTTPS.
| >HTTPS is pretty standard requirement, its a small amount of
| >code for a "battery";
| HTTPS is orthogonal. Besides, how would you support it in the stdlib?
| It's currently not possible to write an SSL server in Python without
| a third-party library. Maybe someone would be interested in
| rectifying /that/? :)
I'd start by making sure that the WSGI implementation adopted is a
"MixIn" to permit its usage in any HTTP Server that has the same
protocol as HTTPServer: including, but not limited to an SSL variant.
I hope that wsgiref can be refactored in this way before it is added
to the standard library (see my implementation, steal at will). Making
it hard-coded to work with HTTPServer is an unnecessary restriction.
I'd also say that the base HTTPServer could use smarter code to deal
with dropped connections: they really arn't errors. Any resonable WSGI
server implementation will need to catch socket.error (and the bastard
variant that the SSL library uses) so that you're not spamming your log
files with ill-behaved clients who use the STOP button. Further, it
would be nice if the "version" string put forth by the BaseHTTPServer
wasn't so intelligent; a simple string would do just fine.
Beyond that, an SSL version of the base HTTPServer is a whole 30 lines
of code, (and much most of this is patching the SSL library's makefile()
method); this could easily go in an "except ImportError" block. I don't
really care one way or the other with this one - I can keep this code in
my own trunk just as happily. However, isn't the idea of the python
standard library to include common "batteries"?
More information about the Web-SIG