fix secure propagation issue
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1e5945f8 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1e5945f8 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1e5945f8 Branch: refs/heads/trunk Commit: 1e5945f8b04a1d123a89c87e855b7e38fcb45a1a Parents: 2f85baa Author: Anthony Shaw <anthonys...@apache.org> Authored: Tue Jan 10 12:43:45 2017 +1100 Committer: Anthony Shaw <anthonys...@apache.org> Committed: Tue Jan 10 12:43:45 2017 +1100 ---------------------------------------------------------------------- libcloud/common/base.py | 3 +++ libcloud/httplib_ssl.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/1e5945f8/libcloud/common/base.py ---------------------------------------------------------------------- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index 3c1de37..d1b26d7 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -459,6 +459,9 @@ class Connection(object): if not hasattr(kwargs, 'port'): kwargs.update({'port': port}) + if not hasattr(kwargs, 'secure'): + kwargs.update({'secure': self.secure}) + if not hasattr(kwargs, 'key_file') and hasattr(self, 'key_file'): kwargs.update({'key_file': getattr(self, 'key_file')}) http://git-wip-us.apache.org/repos/asf/libcloud/blob/1e5945f8/libcloud/httplib_ssl.py ---------------------------------------------------------------------- diff --git a/libcloud/httplib_ssl.py b/libcloud/httplib_ssl.py index 6aff1b3..c88d3ce 100644 --- a/libcloud/httplib_ssl.py +++ b/libcloud/httplib_ssl.py @@ -162,9 +162,10 @@ class LibcloudConnection(LibcloudBaseConnection): host = None response = None - def __init__(self, host, port, **kwargs): + def __init__(self, host, port, secure=None, **kwargs): + scheme = 'https' if secure is not None and secure else 'http' self.host = '{0}://{1}{2}'.format( - 'https' if port == 443 else 'http', + 'https' if port == 443 else scheme, host, ":{0}".format(port) if port not in (80, 443) else "" )