You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/01/13 03:30:30 UTC
[03/10] libcloud git commit: remove get_socket_error_exception as
this behaviour is handled by requests
remove get_socket_error_exception as this behaviour is handled by requests
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4c1fff09
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4c1fff09
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4c1fff09
Branch: refs/heads/trunk
Commit: 4c1fff09a776cc1ebfa9d0776abee807c31d2e18
Parents: 11fc4c8
Author: Anthony Shaw <an...@apache.org>
Authored: Fri Jan 13 13:16:17 2017 +1100
Committer: Anthony Shaw <an...@apache.org>
Committed: Fri Jan 13 13:16:17 2017 +1100
----------------------------------------------------------------------
libcloud/httplib_ssl.py | 48 --------------------------------------------
1 file changed, 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/4c1fff09/libcloud/httplib_ssl.py
----------------------------------------------------------------------
diff --git a/libcloud/httplib_ssl.py b/libcloud/httplib_ssl.py
index 0110e69..302fe25 100644
--- a/libcloud/httplib_ssl.py
+++ b/libcloud/httplib_ssl.py
@@ -36,24 +36,6 @@ ALLOW_REDIRECTS = 1
HTTP_PROXY_ENV_VARIABLE_NAME = 'http_proxy'
-# Error message which is thrown when establishing SSL / TLS connection fails
-UNSUPPORTED_TLS_VERSION_ERROR_MSG = """
-Failed to establish SSL / TLS connection (%s). It is possible that the server \
-doesn't support requested SSL / TLS version (%s).
-For information on how to work around this issue, please see \
-https://libcloud.readthedocs.org/en/latest/other/\
-ssl-certificate-validation.html#changing-used-ssl-tls-version
-""".strip()
-
-# Maps ssl.PROTOCOL_* constant to the actual SSL / TLS version name
-SSL_CONSTANT_TO_TLS_VERSION_MAP = {
- 0: 'SSL v2',
- 2: 'SSLv3, TLS v1.0, TLS v1.1, TLS v1.2',
- 3: 'TLS v1.0',
- 4: 'TLS v1.1',
- 5: 'TLS v1.2'
-}
-
class LibcloudBaseConnection(object):
"""
@@ -290,33 +272,3 @@ class HttpLibResponseProxy(object):
def version(self):
# requests doesn't expose this
return '11'
-
-
-def get_socket_error_exception(ssl_version, exc):
- """
- Function which intercepts socket.error exceptions and re-throws an
- exception with a more user-friendly message in case server doesn't support
- requested SSL version.
- """
- exc_msg = str(exc)
-
- # Re-throw an exception with a more friendly error message
- if 'connection reset by peer' in exc_msg.lower():
- ssl_version_name = SSL_CONSTANT_TO_TLS_VERSION_MAP[ssl_version]
- msg = (UNSUPPORTED_TLS_VERSION_ERROR_MSG %
- (exc_msg, ssl_version_name))
-
- # Note: In some cases arguments are (errno, message) and in
- # other it's just (message,)
- exc_args = getattr(exc, 'args', [])
-
- if len(exc_args) == 2:
- new_exc_args = [exc.args[0], msg]
- else:
- new_exc_args = [msg]
-
- new_exc = socket.error(*new_exc_args)
- new_exc.original_exc = exc
- return new_exc
- else:
- return exc