WSGI/wsgiref: modifying output on windows ?

tjollans@g-NOSPAM-mail.com tjollans at googlemail.com
Mon Jun 4 06:47:50 EDT 2007


On Jun 3, 10:11 pm, "tjoll... at g-NOSPAM-mail.com"
<tjoll... at googlemail.com> wrote:
> Might this be a bug in wsgiref ? I will hopefully be able to do some
> more testing, ...

The following simple CGI script should, AFAIK, on any platform, output
exactly the file specified in code. It does not on Apache 2 on
Windows; I believe this to be a bug in wsgiref.handlers.CGIHandler.
Can someone test this in a similar environment (Windows+a web server?)
to confirm this ? (The first two lines need to be edited depending on
the site)

#!c:\python25\python.exe
fname, type = r'c:\hdr.png', 'image/png'

from wsgiref.handlers import CGIHandler

def wsgiapp(env, start_response):
    f = file(fname, 'rb')
    start_response('200 OK', [('Content-Type', type)])
    return [f.read()]


CGIHandler().run(wsgiapp)




More information about the Python-list mailing list