summaryrefslogtreecommitdiffstats
path: root/Lib/ssl.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-12-04 19:46:20 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-12-04 19:46:20 (GMT)
commit1da3ba8697b3b72f6a1c2d22f7920977d59d661d (patch)
treee153953553e45a49830079e1488f959b38c74bbc /Lib/ssl.py
parent31d83228c2c58d7882a742c1c297893c2508b925 (diff)
downloadcpython-1da3ba8697b3b72f6a1c2d22f7920977d59d661d.zip
cpython-1da3ba8697b3b72f6a1c2d22f7920977d59d661d.tar.gz
cpython-1da3ba8697b3b72f6a1c2d22f7920977d59d661d.tar.bz2
Issue #19509: Don't close the socket in do_handshake() when hostname verification fails.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r--Lib/ssl.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index 08b2df2..052a118 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -764,15 +764,10 @@ class SSLSocket(socket):
self.settimeout(timeout)
if self.context.check_hostname:
- try:
- if not self.server_hostname:
- raise ValueError("check_hostname needs server_hostname "
- "argument")
- match_hostname(self.getpeercert(), self.server_hostname)
- except Exception:
- self.shutdown(_SHUT_RDWR)
- self.close()
- raise
+ if not self.server_hostname:
+ raise ValueError("check_hostname needs server_hostname "
+ "argument")
+ match_hostname(self.getpeercert(), self.server_hostname)
def _real_connect(self, addr, connect_ex):
if self.server_side: