Using Flask, I'd like to get at the bare wsgi.input reference. Looking at the code, there seems to be more than one way to do this, both of which appear in:
werkzeug.wsgi.get_input_stream(environ, safe_fallback=True):
...
if environ.get('wsgi.input_terminated'):
return stream
...
if content_length is None:
return safe_fallback and _empty_stream or stream
...
Annoyingly I can't figure out how to actually get either of these cases to happen (and they're barely mentioned in the docs).
wsgi.input_terminated: I know I can set the wsgi environment if I'm using a proper server like Apache but how do I do it under the Flask dev server, given that Werkzeug hard codes its wsgi environment in werkzeug.serving.make_environ()?
safe_fallback: Can't figure this at all... what's this parameter doing here if it's just called by itself and never passed? How am I supposed to activate it?
Quite possibly missing something easy here...
I know it's pretty old thread but I've found one way to handle chunked encoding requests (I need to have stream not data) and within custom python application (gunicorn + flask), so instead of using
flask.Flask
as app I've created subclass:Anyone has better idea how to do that in a better way?