summaryrefslogtreecommitdiff
path: root/OpenSSL/SSL.py
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSSL/SSL.py')
-rw-r--r--OpenSSL/SSL.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py
index 17775d2..ef37fd2 100644
--- a/OpenSSL/SSL.py
+++ b/OpenSSL/SSL.py
@@ -291,9 +291,9 @@ class _NpnSelectHelper(_CallbackExceptionHelper):
protolist = []
while instr:
l = indexbytes(instr, 0)
- proto = instr[1:l+1]
+ proto = instr[1:l + 1]
protolist.append(proto)
- instr = instr[l+1:]
+ instr = instr[l + 1:]
# Call the callback
outstr = callback(conn, protolist)
@@ -1146,7 +1146,10 @@ class Connection(object):
Look up attributes on the wrapped socket object if they are not found on
the Connection object.
"""
- return getattr(self._socket, name)
+ if self._socket is None:
+ raise AttributeError("'" + self.__class__.__name__ + "' object has no attribute '" + name + "'")
+ else:
+ return getattr(self._socket, name)
def _raise_ssl_error(self, ssl, result):