[Web-SIG] Emulating req.write() in WSGI

P.J. Eby pje at telecommunity.com
Tue Jun 29 21:21:05 CEST 2010

At 12:33 PM 6/29/2010 -0600, Aaron Fransen wrote:
>I was sending text/html (I probably should have used multipart 
>before) ... should I try multipart now, even with having everything 
>in a single stream?

Heck if I know.  I just assumed that what you're doing would be 
unlikely to work, whereas multipart has at least been previously 
documented as working with Apache (at least for nph scripts).  Dunno 
if mod_wsgi'll do that or not.

Actually, what I'd do in your place is try a "nph-" CGI in Python 
(using a wsgiref CGIHandler with its 'origin_server' attribute set to 
True), have it send multipart, and see if that works.  If it doesn't 
work, then it's probably a problem with your app.

If it *does* work, but the same app doesn't work under mod_wsgi, then 
it's a mod_wsgi issue; possibly related to configuration.  From what 
Graham's said, mod_wsgi shouldn't be buffering anything, which means 
it has to either be Apache or your app that's buffering.  If it's 
Apache, doing a proper nph+multipart ought to fix it, unless there's 
something else going on in the Apache configuration.

More information about the Web-SIG mailing list