24595181 glance server set 'None' in Content-Length header
authorSean Wilcox <sean.wilcox@oracle.com>
Mon, 12 Sep 2016 11:26:52 -0700
changeset 6883 beebcb25bedf
parent 6882 9cc65d5f5376
child 6884 b9a6cce2647e
24595181 glance server set 'None' in Content-Length header
components/openstack/glance/patches/03-Partial_Content.patch
--- a/components/openstack/glance/patches/03-Partial_Content.patch	Sat Sep 10 21:27:51 2016 -0700
+++ b/components/openstack/glance/patches/03-Partial_Content.patch	Mon Sep 12 11:26:52 2016 -0700
@@ -38,14 +38,15 @@
          response.headers['Content-Type'] = 'application/octet-stream'
  
          try:
-@@ -317,7 +334,9 @@ class ResponseSerializer(wsgi.JSONRespon
+@@ -317,7 +334,10 @@ class ResponseSerializer(wsgi.JSONRespon
              response.headers['Content-MD5'] = image.checksum
          # NOTE(markwash): "response.app_iter = ..." also erroneously resets the
          # content-length
 -        response.headers['Content-Length'] = str(image.size)
 +        # NOTE(mattk): Should be set to chunk_size or image.size
 +        response.headers['Content-Length'] = \
-+            str(chunk_size) if chunk_size != 0 else str(image.size)
++            str(chunk_size) if (chunk_size is not None and chunk_size != 0) \
++            else str(image.size)
  
      def upload(self, response, result):
          response.status_int = 204