Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Add missing Content-MD5 header to the POST Object Restore request #2068

wants to merge 1 commit into from

2 participants


I tried to write a unit test for this change but unfortunately AWS takes an indefinite amount of time to transition objects to glacier even when you set 0 days which makes automating a restore test case difficult.

I tested this manually though and sniffed the request/response to show its setting the header now and that AWS accepted the request. Note: I modified the Authorization header when I pasted it below.

POST /meta?restore HTTP/1.1.
Accept-Encoding: identity.
Date: Mon, 03 Feb 2014 02:29:34 GMT.
Content-Length: 155.
User-Agent: Boto/2.23.0 Python/2.7.3 Linux/3.9.10-100.fc17.x86_64.
Authorization: AWS BLAH:BLAH.
Content-MD5: 52ovPBx7I1yaJo86KXcVdQ==.
<?xml version="1.0" encoding="UTF-8"?>
      <RestoreRequest xmlns="">
T -> [A]
T -> [AP]
HTTP/1.1 202 Accepted.
x-amz-id-2: Tr0my0QQoMKf3Ru7pym0b+8mtHQIBR5ZqOuiugYh+5dEl4SzQriEIlRKk1N+JGEc.
x-amz-request-id: 9460B322F2BFCF8C.
Date: Mon, 03 Feb 2014 02:29:35 GMT.
Content-Length: 0.
Server: AmazonS3.

Hi @danielgtaylor, Anything I need to do to get this pull request in. I saw that you labelled it. We've been using it for over a year now in a branch that I maintain and its working well. If you want it rebased against a latest develop branch I can do that.


Does the label 'Needs repro' mean I need to do something? Sorry can't think what repro could mean right now. Probably obvious in retrospect... Bracing...


I rebased this against the latest develop branch just in case. Let me know if you need anything else. As mentioned earlier it's a hard one to write a unit test for because of the long time involved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 1 deletion.
  1. +5 −1 boto/s3/
6 boto/s3/
@@ -1910,9 +1910,13 @@ def restore(self, days, headers=None):
respect to the completion time of the request.
+ data = self.RestoreBody % days
+ md5 = compute_md5(StringIO.StringIO(data))
+ headers = headers or {}
+ headers['Content-MD5'] = md5[1]
response = self.bucket.connection.make_request(
- data=self.RestoreBody % days,
+ data=data,
headers=headers, query_args='restore')
if response.status not in (200, 202):
provider = self.bucket.connection.provider
Something went wrong with that request. Please try again.