Retrying the Fix for https://github.com/apache/libcloud/pull/845/
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c674922a Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c674922a Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c674922a Branch: refs/heads/trunk Commit: c674922acd99a396f545a3c8b228db4c6489d5e1 Parents: 6f9e428 Author: Luke Morfitt <lukemorfitt@Lukes-MacBook-Pro.local> Authored: Thu Sep 22 10:24:04 2016 +0100 Committer: Luke Morfitt <lukemorfitt@Lukes-MacBook-Pro.local> Committed: Thu Sep 22 10:24:04 2016 +0100 ---------------------------------------------------------------------- libcloud/common/azure.py | 2 ++ libcloud/common/base.py | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/c674922a/libcloud/common/azure.py ---------------------------------------------------------------------- diff --git a/libcloud/common/azure.py b/libcloud/common/azure.py index b7f9ffc..cbba052 100644 --- a/libcloud/common/azure.py +++ b/libcloud/common/azure.py @@ -112,6 +112,8 @@ class AzureConnection(ConnectionUserAndKey): responseCls = AzureResponse rawResponseCls = AzureRawResponse + skip_host = False + skip_accept_encoding = False def add_default_params(self, params): return params http://git-wip-us.apache.org/repos/asf/libcloud/blob/c674922a/libcloud/common/base.py ---------------------------------------------------------------------- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index 540244d..6a97564 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -118,6 +118,7 @@ class HTTPResponse(httplib.HTTPResponse): # In particular this happens on S3 when calls are made to get_object to # objects that don't exist. # This applies the behaviour from 2.7, fixing the hangs. + def read(self, amt=None): if self.fp is None: return '' @@ -354,6 +355,7 @@ class LoggingConnection(): # this is evil. laugh with me. ha arharhrhahahaha class fakesock(object): + def __init__(self, s): self.s = s @@ -532,6 +534,8 @@ class Connection(object): retry_delay = None allow_insecure = True + skip_host = True + skip_accept_encoding = True def __init__(self, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, retry_delay=None, backoff=None): @@ -778,6 +782,9 @@ class Connection(object): else: headers.update({'Host': self.host}) + skip_host = self.skip_host + skip_accept_encoding = self.skip_accept_encoding + if data: data = self.encode_data(data) headers['Content-Length'] = str(len(data)) @@ -807,9 +814,11 @@ class Connection(object): # @TODO: Should we just pass File object as body to request method # instead of dealing with splitting and sending the file ourselves? if raw: - self.connection.putrequest(method, url, - skip_host=1, - skip_accept_encoding=1) + self.connection.putrequest( + method, + url, + skip_host=skip_host, + skip_accept_encoding=skip_accept_encoding) for key, value in list(headers.items()): self.connection.putheader(key, str(value)) @@ -1050,6 +1059,7 @@ class ConnectionKey(Connection): """ Base connection class which accepts a single ``key`` argument. """ + def __init__(self, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None): """ @@ -1069,6 +1079,7 @@ class CertificateConnection(Connection): """ Base connection class which accepts a single ``cert_file`` argument. """ + def __init__(self, cert_file, secure=True, host=None, port=None, url=None, proxy_url=None, timeout=None, backoff=None, retry_delay=None): """