Add SSL URI support for LIBCLOUD-458

Add an optional argument to retrieve the x-cdn-ssl-uri of a Cloud Files
container.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/b21787bd
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/b21787bd
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/b21787bd

Branch: refs/heads/trunk
Commit: b21787bd4f500bee9e61f700bb21b2e88bf21d1a
Parents: acce779
Author: ayleph <ayl...@thisshitistemp.com>
Authored: Wed Jun 21 22:13:17 2017 -0700
Committer: Anthony Shaw <anthonys...@apache.org>
Committed: Fri Aug 11 14:30:41 2017 +1000

----------------------------------------------------------------------
 libcloud/storage/drivers/cloudfiles.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/b21787bd/libcloud/storage/drivers/cloudfiles.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/cloudfiles.py 
b/libcloud/storage/drivers/cloudfiles.py
index 1a249a1..33d8301 100644
--- a/libcloud/storage/drivers/cloudfiles.py
+++ b/libcloud/storage/drivers/cloudfiles.py
@@ -310,7 +310,7 @@ class CloudFilesStorageDriver(StorageDriver, 
OpenStackDriverMixin):
 
         raise LibcloudError('Unexpected status code: %s' % (response.status))
 
-    def get_container_cdn_url(self, container):
+    def get_container_cdn_url(self, container, ssl_uri=False):
         # pylint: disable=unexpected-keyword-arg
         container_name_encoded = self._encode_container_name(container.name)
         response = self.connection.request('/%s' % (container_name_encoded),
@@ -318,7 +318,10 @@ class CloudFilesStorageDriver(StorageDriver, 
OpenStackDriverMixin):
                                            cdn_request=True)
 
         if response.status == httplib.NO_CONTENT:
-            cdn_url = response.headers['x-cdn-uri']
+            if ssl_uri == True:
+                cdn_url = response.headers['x-cdn-ssl-uri']
+            else:
+                cdn_url = response.headers['x-cdn-uri']
             return cdn_url
         elif response.status == httplib.NOT_FOUND:
             raise ContainerDoesNotExistError(value='',

Reply via email to