2009/2/9 gert <[email protected]>:
>
> when i comment out wsgi.file it works
>
> from os import path
>        f=open(path.join(path.dirname(__file__),'../bin/
> picture.png'),'rb')
>        # if 'wsgi.file_wrapper' in environ: return environ
> ['wsgi.file_wrapper'](f, 8192)
>        # else:
>        return iter(lambda: f.read(8192), '')

Use the test script from genro's post on February 4th in discussion:

  http://groups.google.com/group/modwsgi/browse_frm/thread/69d3076689a40aa9

In particular:

def application(environ, start_response):
    size=environ.get('QUERY_STRING')
    if size=='': size='255'
    size=int(size)
    file=open('tmp/wsgitest','wb')
    for i in range(size):
        file.write('*')
    file.close()
    file=open('tmp/wsgitest','rb')
    file_wrapper = environ.get('wsgi.file_wrapper', None)
    start_response('200 OK',[])
    return file_wrapper(file, 4096*16)

See if you find similar results where whether it works depends on file size.

It is interesting that genro sees a difference at 256, as that is a
key value in Apache for which below it doesn't try and use sendfile.

  #define AP_MIN_SENDFILE_BYTES           (256)

Another interesting constant in Apache is:

  #define AP_MIN_BYTES_TO_WRITE  8000

Which is close to the other end of the range where they see a problem.

I haven't myself yet had a chance since getting back home yesterday to
try that test script.

PS. When replying, please do not discard the previous posts of the
discussion so context isn't lost.

Graham

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to