Browse code

* S3/S3.py: Re-upload when Amazon doesn't send ETag in PUT response. It happens from time to time for unknown reasons. Thanks "Burtc" for report and "hermzz" for fix. Fixes #1990387

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@204 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2008/06/30 22:38:12
Showing 2 changed files
... ...
@@ -1,3 +1,10 @@
1
+2008-06-30  Michal Ludvig  <michal@logix.cz>
2
+
3
+	* S3/S3.py: Re-upload when Amazon doesn't send ETag
4
+	  in PUT response. It happens from time to time for
5
+	  unknown reasons. Thanks "Burtc" for report and
6
+	  "hermzz" for fix.
7
+
1 8
 2008-06-27  Michal Ludvig  <michal@logix.cz>
2 9
 
3 10
 	* Released version 0.9.8.1
... ...
@@ -381,6 +381,11 @@ class S3(object):
381 381
 			info("Redirected to: %s" % (redir_hostname))
382 382
 			return self.send_file(request, file)
383 383
 
384
+		# S3 from time to time doesn't send ETag back in a response :-(
385
+		# Force re-upload here.
386
+		if not response['headers'].has_key('etag'):
387
+			response['headers']['etag'] = '' 
388
+
384 389
 		debug("MD5 sums: computed=%s, received=%s" % (md5_computed, response["headers"]["etag"]))
385 390
 		if response["headers"]["etag"].strip('"\'') != md5_hash.hexdigest():
386 391
 			warning("MD5 Sums don't match!")