[Python-checkins] cpython: Issue 19509: Don't call match_hostname() twice in http.client.
christian.heimes
python-checkins at python.org
Thu Dec 5 07:53:52 CET 2013
http://hg.python.org/cpython/rev/1a945fb875bf
changeset: 87776:1a945fb875bf
user: Christian Heimes <christian at cheimes.de>
date: Thu Dec 05 07:51:17 2013 +0100
summary:
Issue 19509: Don't call match_hostname() twice in http.client.
files:
Lib/http/client.py | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Lib/http/client.py b/Lib/http/client.py
--- a/Lib/http/client.py
+++ b/Lib/http/client.py
@@ -1204,13 +1204,13 @@
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")
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list