2009/8/26 gert <[email protected]>:
>
> curl http://192.168.2.17/appwsgi/wsgi/download2.wsgi -v
>
> this does not work
> response('200 OK', [('Content-Type', 'text/plain'), ('Content-Length',
> lengthC), ('Content-Range', bytes), ('Transfer-Encoding', 'chunked')])
> curl: (56) Received problem 2 in the chunky parser
That is forbidden for WSGI. That is, WSGI application is not allowed
to set Transfer-Encoding response header. This is mentioned in WSGI
specification. What are you actually trying to do?
Graham
> this does work
> response('200 OK', [('Content-Type', 'text/plain'), ('Content-Length',
> lengthC), ('Content-Range', bytes)])
>
> So basically I think chunked transfer encoding does not work in daemon
> mode anymore, you can try with any example you like.
> All print(...) code in wsgi script show up in the log file in both
> cases. There are no other log indications from mod_wsgi itself.
> Chunked transfer is enabled in apache conf
>
> LoadModule wsgi_module modules/mod_wsgi.so
> WSGIDaemonProcess www python-path=/usr/httpd/www user=www group=www
> processes=1 threads=1 display-name="wsgi: www"
> WSGIProcessGroup www
> WSGIApplicationGroup %{GLOBAL}
> WSGIChunkedRequest On
> WSGILazyInitialization On
> WSGIRestrictEmbedded On
>
> On Aug 25, 2:22 pm, Graham Dumpleton <[email protected]>
> wrote:
>> Gert, now that logging of exceptions in Python 3.X is working again
>> for module level errors, can you indicate whether error is being
>> generated for following, or whether still some other issue you don't
>> understand. Ensure you explain details well as I don't have time to
>> troll through it and try and work it out myself.
>>
>> 2009/8/16 gert <[email protected]>:
>>
>>
>>
>> > this downloads itself without chunked
>>
>> > r...@localhost:/usr/httpd/www/appwsgi/wsgi# curl
>> >http://192.168.2.17/appwsgi/wsgi/download2.wsgi?download2.wsgi
>> > import os,sys
>>
>> > class FileWrapper(object):
>> > def __init__(self, fp, blksize=8192):
>> > self.fp = fp
>> > self.blksize=blksize
>> > def __getitem__(self, key):
>> > data = self.fp.read(self.blksize)
>> > if data: return data
>> > raise IndexError
>> > def close(self):
>> > self.fp.close()
>>
>> > def application(environ, response):
>> > query=environ['QUERY_STRING']
>> > print (query, file=sys.stderr)
>> > query=os.path.join(os.path.dirname(__file__),query)
>> > range=environ.get('HTTP_RANGE','bytes=0-').replace
>> > ('bytes=','').split(',')
>> > offset=[]
>> > for r in range: offset.append(r.split('-'))
>> > f=open(query, 'rb')
>> > f.seek(int(offset[0][0]))
>> > lengthF=os.fstat(f.fileno()).st_size
>> > lengthC=str(lengthF-int(offset[0][0]))
>> > bitS=int(offset[0][0])
>> > bitE=lengthF-1
>> > bytes='bytes '+str(bitS)+'-'+str(bitE)+'/'+str(lengthF)
>> > #response('200 OK', [('Content-Type', 'image/png'), ('Content-
>> > Length', lengthC), ('Content-Range', bytes), ])
>> > response('200 OK', [('Content-Type', 'image/png'), ('Content-
>> > Length', lengthC), ('Content-Range', bytes)])
>> > if 'wsgi.file_wrapper' in environ: return environ
>> > ['wsgi.file_wrapper'](f, 8192)
>> > else: return FileWrapper(f, 8192)
>>
>> > this downloads itself with chunked ?
>>
>> > r...@localhost:/usr/httpd/www/appwsgi/wsgi# curl
>> >http://192.168.2.17/appwsgi/wsgi/download2.wsgi?download2.wsgi-v
>> > * About to connect() to 192.168.2.17 port 80 (#0)
>> > * Trying 192.168.2.17... connected
>> > * Connected to 192.168.2.17 (192.168.2.17) port 80 (#0)
>> >> GET /appwsgi/wsgi/download2.wsgi?download2.wsgi HTTP/1.1
>> >> User-Agent: curl/7.19.5 (x86_64-pc-linux-gnu) libcurl/7.19.5
>> >> OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.15
>> >> Host: 192.168.2.17
>> >> Accept: */*
>>
>> > < HTTP/1.1 200 OK
>> > < Date: Sat, 15 Aug 2009 21:57:50 GMT
>> > < Server: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8g mod_wsgi/
>> > 3.0c5-TRUNK Python/3.1
>> > < Content-Length: 1273
>> > < Content-Range: bytes 0-1272/1273
>> > < Transfer-Encoding: chunked
>> > < Content-Type: image/png
>> > < X-Pad: avoid browser bug
>> > <
>> > * Received problem 2 in the chunky parser
>> > * Closing connection #0
>> > curl: (56) Received problem 2 in the chunky parser
>> > r...@localhost:/usr/httpd/www/appwsgi/wsgi#
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---