Commit b19301cb authored by Antoine Pitrou's avatar Antoine Pitrou

Merged revisions 80507 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80507 | antoine.pitrou | 2010-04-26 19:23:33 +0200 (lun., 26 avril 2010) | 4 lines

  When calling getpeername() in SSLSocket.__init__, only silence exceptions
  caused by the "socket not connected" condition.
........
parent 6dddaa46
...@@ -75,8 +75,10 @@ from _ssl import \ ...@@ -75,8 +75,10 @@ from _ssl import \
SSL_ERROR_INVALID_ERROR_CODE SSL_ERROR_INVALID_ERROR_CODE
from socket import socket, _fileobject, _delegate_methods from socket import socket, _fileobject, _delegate_methods
from socket import error as socket_error
from socket import getnameinfo as _getnameinfo from socket import getnameinfo as _getnameinfo
import base64 # for DER-to-PEM translation import base64 # for DER-to-PEM translation
import errno
class SSLSocket(socket): class SSLSocket(socket):
...@@ -104,7 +106,9 @@ class SSLSocket(socket): ...@@ -104,7 +106,9 @@ class SSLSocket(socket):
# see if it's connected # see if it's connected
try: try:
socket.getpeername(self) socket.getpeername(self)
except: except socket_error, e:
if e.errno != errno.ENOTCONN:
raise
# no, no connection yet # no, no connection yet
self._sslobj = None self._sslobj = None
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment