** Changed in: python-webob (Ubuntu)
       Status: Incomplete => Fix Released

You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.

  Unable to set Content-MD5 header when using chunked transfer encoding

Status in Glance:
  Fix Released
Status in Glance grizzly series:
  Fix Released
Status in python-webob package in Ubuntu:
  Fix Released

Bug description:
  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)

To manage notifications about this bug go to:

Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to