diff options
author | Christian Heimes <christian@cheimes.de> | 2013-12-04 19:46:20 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-12-04 19:46:20 (GMT) |
commit | 1da3ba8697b3b72f6a1c2d22f7920977d59d661d (patch) | |
tree | e153953553e45a49830079e1488f959b38c74bbc /Lib/ssl.py | |
parent | 31d83228c2c58d7882a742c1c297893c2508b925 (diff) | |
download | cpython-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.py | 13 |
1 files changed, 4 insertions, 9 deletions
@@ -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: |