diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-28 17:23:55 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-28 17:23:55 (GMT) |
commit | 15399c3f09cfe779c1d55c0773db31824504ea31 (patch) | |
tree | b10dfaa6543c1c2116c6098150ef4cb112b5df68 /Lib/ssl.py | |
parent | 9c39f3c4ec0cfc3655b95c3637c4222ecb173f33 (diff) | |
download | cpython-15399c3f09cfe779c1d55c0773db31824504ea31.zip cpython-15399c3f09cfe779c1d55c0773db31824504ea31.tar.gz cpython-15399c3f09cfe779c1d55c0773db31824504ea31.tar.bz2 |
Issue #11811: ssl.get_server_certificate() is now IPv6-compatible. Patch
by Charles-François Natali.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r-- | Lib/ssl.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -81,7 +81,7 @@ from _ssl import HAS_SNI from socket import getnameinfo as _getnameinfo from socket import error as socket_error -from socket import socket, AF_INET, SOCK_STREAM +from socket import socket, AF_INET, SOCK_STREAM, create_connection import base64 # for DER-to-PEM translation import traceback import errno @@ -543,9 +543,9 @@ def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None): cert_reqs = CERT_REQUIRED else: cert_reqs = CERT_NONE - s = wrap_socket(socket(), ssl_version=ssl_version, + s = create_connection(addr) + s = wrap_socket(s, ssl_version=ssl_version, cert_reqs=cert_reqs, ca_certs=ca_certs) - s.connect(addr) dercert = s.getpeercert(True) s.close() return DER_cert_to_PEM_cert(dercert) |