diff --git a/glance/api/v2/image_data.py b/glance/api/v2/image_data.py index 928b3ba..8b4938f 100644 --- a/glance/api/v2/image_data.py +++ b/glance/api/v2/image_data.py @@ -227,7 +227,10 @@ class ResponseSerializer(wsgi.JSONResponseSerializer): response.headers['Content-MD5'] = image.checksum # NOTE(markwash): "response.app_iter = ..." also erroneously resets the # content-length - response.headers['Content-Length'] = str(image.size) + # If returning partial content Content-Length should be set to chunk_size + response.headers['Content-Length'] = \ + str(chunk_size) if chunk_size != 0 else str(image.size) + def upload(self, response, result): response.status_int = 204