summaryrefslogtreecommitdiff
path: root/tests/testfilewrapper.py
Commit message (Collapse)AuthorAgeFilesLines
* python: support io.BytesIO with wsgi.file_wrapperArne Welzel2019-09-071-0/+122
Should solve #1126 This change proposes to move the `PyObject_AsFileDescriptor()` calls from the `wsgi.file_wrapper` into the response handler. In the response handler, we can sensibly fall back to the `read()` protocol using the existing `uwsgi_python_consume_file_wrapper_read()` if converting the file-like object to an fd fails. Previously, after the conversion to an fd failed, the `wsgi.file_wrapper` raised a SystemError. Running the added test application requires flask, start as follows: uwsgi --enable-threads --workers 1 --threads 1 \ --plugin ./python37_plugin.so --http-socket :5000 \ -H ./venv/ --wsgi-file ./tests/testfilewrapper.py $ for i in {1..3} ; do echo -n "test $i - "; curl localhost:5000/$i ; done test 1 - cookie test 2 - cookie test 3 - cookie2 $ for i in {1..3} ; do echo -n "test $i - "; curl localhost:5000/stream$i ; done test 1 - 0.10 cookie 0.20 cookie 0.30 cookie test 2 - cookie test 3 - cookie