diff options
author | Christian Heimes <christian@cheimes.de> | 2013-12-05 06:51:17 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2013-12-05 06:51:17 (GMT) |
commit | f723c711d3a798793af1505f7bdaf1bf622ef88e (patch) | |
tree | 5571c2f1b0cb54f124d12a776f62557ac32779bf /Lib/http | |
parent | c6d471d6533a24c461e72668398931dc6014fa28 (diff) | |
download | cpython-f723c711d3a798793af1505f7bdaf1bf622ef88e.zip cpython-f723c711d3a798793af1505f7bdaf1bf622ef88e.tar.gz cpython-f723c711d3a798793af1505f7bdaf1bf622ef88e.tar.bz2 |
Issue 19509: Don't call match_hostname() twice in http.client.
Diffstat (limited to 'Lib/http')
-rw-r--r-- | Lib/http/client.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/http/client.py b/Lib/http/client.py index 5c52ba3..56f548a 100644 --- a/Lib/http/client.py +++ b/Lib/http/client.py @@ -1204,13 +1204,13 @@ else: server_hostname = self.host if ssl.HAS_SNI else None self.sock = self._context.wrap_socket(sock, server_hostname=server_hostname) - try: - if self._check_hostname: + if not self._context.check_hostname and self._check_hostname: + try: ssl.match_hostname(self.sock.getpeercert(), self.host) - except Exception: - self.sock.shutdown(socket.SHUT_RDWR) - self.sock.close() - raise + except Exception: + self.sock.shutdown(socket.SHUT_RDWR) + self.sock.close() + raise __all__.append("HTTPSConnection") |