[Bug 1083155] [NEW] Unable to set Content-MD5 header when using chunked transfer encoding
James Page
james.page at ubuntu.com
Mon Nov 26 13:19:58 UTC 2012
Public bug reported:
I came across this when debugging test failures of Openstack Glance with
Webob 1.1.1 as found in 12.04+
Taking the following code from glance:
def download(self, response, result):
size = result['meta']['size']
checksum = result['meta']['checksum']
response.headers['Content-Length'] = size
response.headers['Content-Type'] = 'application/octet-stream'
if checksum:
response.headers['Content-MD5'] = checksum
response.app_iter = common.size_checked_iter(
response, result['meta'], size, result['data'], self.notifier)
This should create a response with appropriate headers (including a MD5
checksum) and then use the iterator to return the content (potentially a
large image) to the calling client; however when:
response.app_iter = ...
occurs the MD5 that was set in the preceeding line is set back to 'None'
in the response object; result is a chunked transfer encoded response
without a checksum (which should be supported). I traced this back to
webob/response.py:
def _app_iter__set(self, value):
if self._app_iter is not None:
# Undo the automatically-set content-length
self.content_length = None
self.content_md5 = None
self._app_iter = value
During construction of the object, neither the app_iter or body is
specified and as a result the body is set to '' (and the app_iter to [
'' ]). So even though no data has ever been provided, the md5 sum is
dropped as soon as the iterator is provided.
ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: python-webob 1.1.1-1ubuntu1
ProcVersionSignature: Ubuntu 3.5.0-18.29-generic 3.5.7
Uname: Linux 3.5.0-18-generic x86_64
ApportVersion: 2.6.1-0ubuntu6
Architecture: amd64
Date: Mon Nov 26 13:12:45 2012
MarkForUpload: True
PackageArchitecture: all
SourcePackage: python-webob
UpgradeStatus: Upgraded to quantal on 2012-06-11 (168 days ago)
** Affects: python-webob (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug quantal running-unity
--
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to python-webob in Ubuntu.
https://bugs.launchpad.net/bugs/1083155
Title:
Unable to set Content-MD5 header when using chunked transfer encoding
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-webob/+bug/1083155/+subscriptions
More information about the Ubuntu-server-bugs
mailing list