PyDocs

Nav

Networking and Interprocess Communication

SSLContext.check_hostname

ssl

attribute of SSLContext · Added in 3.4not WASI
Whether to match the peer cert’s hostname in SSLSocket.do_handshake(). The context’s verify_mode must be set to CERT_OPTIONAL or CERT_REQUIRED, and you must pass server_hostname to wrap_socket() in order to match the hostname. Enabling hostname checking automatically sets verify_mode from CERT_NONE to CERT_REQUIRED. It cannot be set back to CERT_NONE as long as hostname checking is enabled. The PROTOCOL_TLS_CLIENT protocol enables hostname checking by default. With other protocols, hostname checking must be enabled explicitly.
Changed in 3.7
  • 3.7: verify_mode is now automatically changed to CERT_REQUIRED when hostname checking is enabled and verify_mode is CERT_NONE. Previously the same operation would have failed with a ValueError.
0 Examples
No examples for ssl/SSLContext.check_hostname.
See Also
No see-alsos for ssl/SSLContext.check_hostname
0 Notes
No notes for SSLContext.check_hostname