python - Is there a wsgi server that will do progressive Transfer-Encoding: chunked -
is there wsgi webserver can progressive transfer-encoding: chunked? i.e. should write content socket received application.
i tried following app wsgiref, waitress, , gunicorn. none of them write 'first bit of content' straight away..
import time def app(environ, start_response): start_response('200 ok', [('content-type', 'text/plain')]) def content(): yield 'first bit of content\n' time.sleep(5) yield 'second bit of content' return content()
thanks tips jon, got working in waitress:
import time def app(environ, start_response): start_response('200 ok', [('content-type', 'text/plain')]) def content(): yield ''.join(('first bit of content', '.' * 18000, '\n')) time.sleep(5) yield 'second bit of content' return content() import waitress waitress.serve(app, host='0.0.0.0', port=8080) waitress send data when reaches 18000 bytes (which configurable when create server.)
Comments
Post a Comment