Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6d471d commit f723c71Copy full SHA for f723c71
1 file changed
Lib/http/client.py
@@ -1204,13 +1204,13 @@ def connect(self):
1204
server_hostname = self.host if ssl.HAS_SNI else None
1205
self.sock = self._context.wrap_socket(sock,
1206
server_hostname=server_hostname)
1207
- try:
1208
- if self._check_hostname:
+ if not self._context.check_hostname and self._check_hostname:
+ try:
1209
ssl.match_hostname(self.sock.getpeercert(), self.host)
1210
- except Exception:
1211
- self.sock.shutdown(socket.SHUT_RDWR)
1212
- self.sock.close()
1213
- raise
+ except Exception:
+ self.sock.shutdown(socket.SHUT_RDWR)
+ self.sock.close()
+ raise
1214
1215
__all__.append("HTTPSConnection")
1216
0 commit comments