commit bf7887a102ca33dd46ef24b67b07eb77154ce133
Author: Matthew Treinish <email address hidden>
Date: Wed Aug 16 10:29:46 2017 -0400
Replace body_file with class to call uwsgi.chunked_read()
Since the WebOb 1.7 release webob doesn't natively support receiving
chunked transfer encoding bodies. [1] When glance is run under the
eventlet wsgi server this was fine, because eventlet will dechunk the
input on read() (or readline()) calls, so from the webob perspective
it's just a file object. However, the effort to remove the dependence
on using eventlet as the web server and deploy glance as a traditional
wsgi script we lose this mechanism. The wsgi spec doesn't provide a
consistent mechanism
When we run glance under uwsgi the uwsgi server provides an api to read
chunked data. [2] However, we need to explicitly call that api when to
dechunk the data and pass it to glance code which expects a file object.
This commit solves this issue by creating a fake file class that will
call the chunked_read() api from uwsgi on read() calls. This object is
then used if we're running the api code under uwsgi and the body has a
chunked transfer-encoding.
In conjuction with devstack change
Iab2e2848877fa1497008d18c05b0154892941589 this closes glance bug 1703856
Reviewed: https:/ /review. openstack. org/493654 /git.openstack. org/cgit/ openstack/ glance/ commit/ ?id=bf7887a102c a33dd46ef24b67b 07eb77154ce133
Committed: https:/
Submitter: Zuul
Branch: master
commit bf7887a102ca33d d46ef24b67b07eb 77154ce133
Author: Matthew Treinish <email address hidden>
Date: Wed Aug 16 10:29:46 2017 -0400
Replace body_file with class to call uwsgi.chunked_ read()
Since the WebOb 1.7 release webob doesn't natively support receiving
chunked transfer encoding bodies. [1] When glance is run under the
eventlet wsgi server this was fine, because eventlet will dechunk the
input on read() (or readline()) calls, so from the webob perspective
it's just a file object. However, the effort to remove the dependence
on using eventlet as the web server and deploy glance as a traditional
wsgi script we lose this mechanism. The wsgi spec doesn't provide a
consistent mechanism
When we run glance under uwsgi the uwsgi server provides an api to read
chunked data. [2] However, we need to explicitly call that api when to
dechunk the data and pass it to glance code which expects a file object.
This commit solves this issue by creating a fake file class that will
call the chunked_read() api from uwsgi on read() calls. This object is
then used if we're running the api code under uwsgi and the body has a
chunked transfer-encoding.
In conjuction with devstack change 7fa1497008d18c0 5b0154892941589 this closes glance bug 1703856
Iab2e284887
[1] https:/ /docs.pylonspro ject.org/ projects/ webob/en/ stable/ whatsnew- 1.7.html# backwards- incompatibility uwsgi-docs. readthedocs. io/en/latest/ Chunked. html
[2] http://
Partial-bug 1703856
Co-Authored-By: Chris Dent <email address hidden>
Change-Id: Idf6b4b891ba31c ccbeb53d373b40f ce5380cea64