Browse code

2008-02-11 Michal Ludvig <michal@logix.cz>

* S3/S3.py: Create public buckets with -P (#1837328)



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

Michal Ludvig authored on 2008/02/11 12:39:59
Showing 2 changed files
... ...
@@ -1,6 +1,7 @@
1 1
 2008-02-11  Michal Ludvig  <michal@logix.cz>
2 2
 
3 3
 	* S3/S3.py: Properly follow RedirectPermanent responses for EU buckets
4
+	* S3/S3.py: Create public buckets with -P (#1837328)
4 5
 	* S3/S3.py, s3cmd: Correctly display public URL on uploads.
5 6
 	* S3/S3.py, S3/Config.py: Support for MIME types. Both 
6 7
 	default and guessing. Fixes bug #1872192 (Thanks Martin Herr)
... ...
@@ -141,7 +141,9 @@ class S3(object):
141 141
 		while _list_truncated(response["data"]):
142 142
 			marker = list[-1]["Key"]
143 143
 			info("Listing continues after '%s'" % marker)
144
-			request = self.create_request("BUCKET_LIST", bucket = bucket, prefix = prefix, marker = marker)
144
+			request = self.create_request("BUCKET_LIST", bucket = bucket,
145
+			                              prefix = prefix, 
146
+			                              marker = self.urlencode_string(marker))
145 147
 			response = self.send_request(request)
146 148
 			list += _get_contents(response["data"])
147 149
 		response['list'] = list
... ...
@@ -157,6 +159,8 @@ class S3(object):
157 157
 			body += "</LocationConstraint></CreateBucketConfiguration>"
158 158
 			debug("bucket_location: " + body)
159 159
 		headers["content-length"] = len(body)
160
+		if self.config.acl_public:
161
+			headers["x-amz-acl"] = "public-read"
160 162
 		request = self.create_request("BUCKET_CREATE", bucket = bucket, headers = headers)
161 163
 		response = self.send_request(request, body)
162 164
 		return response