S3 requires seekable file. webob versions 0.9.8 through 1.0.7 make_body_seekable() method broken for chunked transfer requests
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Fix Released
|
Low
|
Jay Pipes |
Bug Description
This is a fairly complicated bug in the upstream webob library. Different versions of the webob library have different problems with handling chunked transfer requests in the webob.Request object:
webob 0.9.8
Does not have a webob.Request.
def make_body_
"""
This forces ``environ[
is, if it doesn't have a `seek` method already, the content is
copied into a StringIO or temporary file.
The choice to copy to StringIO is made from
"""
input = self.body_file
if hasattr(input, 'seek'):
# It has a seek method, so we don't need to do anything
return
def copy_body(self):
"""
Copies the body, in cases where it might be shared with
another request object and that is not desired.
This copies the body in-place, either into a StringIO object
or a temporary file.
"""
length = self.content_length
if length == 0:
# No real need to copy this, but of course it is free
return
This unfortunately unsets the body of the request, which means a content-length of 0 and a body of '' is passed along to the backend.
The S3 backend requires a *seekable* body_file attribute, and in 0.9.8, the only way to provide this is to call make_body_
webob 1.0.3 through 1.0.6:
See http://
Unfortunately, in this particular version of webob, the Request's body_file object is not readable in a secure way
webob 1.0.7:
See https:/
In this version of webob.Request, for chunked transfer requests, the webob.Request.
The solution here is to set Request.
So, we unfortunately need to standardize on webob 1.0.7+ if we are to support the S3 backend (which requires a seekable body_file) and support Swift backends properly for chunked transfer encoding.
Swift has already standardized on 1.0.7+ for similar reasons, so I think we should do the same.
Related branches
- Brian Waldon (community): Approve
- Brian Lamar (community): Approve
- Dan Prince: Pending requested
- Christopher MacGown: Pending requested
- Rick Harris: Pending requested
-
Diff: 1523 lines (+1276/-84)10 files modifieddoc/source/configuring.rst (+82/-0)
etc/glance-api.conf (+23/-0)
glance/api/v1/images.py (+5/-0)
glance/store/s3.py (+259/-66)
tests/functional/__init__.py (+8/-0)
tests/functional/test_s3.conf (+21/-0)
tests/functional/test_s3.py (+532/-0)
tests/unit/test_s3_store.py (+345/-0)
tests/unit/test_stores.py (+0/-18)
tools/pip-requires (+1/-0)
summary: |
- S3 requires seekable file. webob versions 0.9.8 through 1.0.6 + S3 requires seekable file. webob versions 0.9.8 through 1.0.7 make_body_seekable() method broken for chunked transfer requests |
Changed in glance: | |
status: | Triaged → Fix Committed |
status: | Fix Committed → In Progress |
Changed in glance: | |
milestone: | diablo-2 → diablo-3 |
Changed in glance: | |
milestone: | diablo-3 → diablo-4 |
Changed in glance: | |
status: | In Progress → Fix Committed |
Changed in glance: | |
milestone: | diablo-4 → 2011.3 |
status: | Fix Committed → Fix Released |