summaryrefslogtreecommitdiff
path: root/Doc/library/ssl.rst
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2017-09-15 20:29:57 +0200
committerGitHub <noreply@github.com>2017-09-15 20:29:57 +0200
commite82c034496512139e9ea3f68ceda86c04bc7baab (patch)
tree1fab1d26c6edba33d400598e705dd7269cf77e12 /Doc/library/ssl.rst
parenta170fa162dc03f0a014373349e548954fff2e567 (diff)
downloadcpython-git-e82c034496512139e9ea3f68ceda86c04bc7baab.tar.gz
bpo-31431: SSLContext.check_hostname auto-sets CERT_REQUIRED (#3531)
Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Doc/library/ssl.rst')
-rw-r--r--Doc/library/ssl.rst12
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index eb4d8ace3d..1f3e8d5f78 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -1674,7 +1674,10 @@ to speed up repeated connections from the same clients.
:meth:`SSLSocket.do_handshake`. The context's
:attr:`~SSLContext.verify_mode` must be set to :data:`CERT_OPTIONAL` or
:data:`CERT_REQUIRED`, and you must pass *server_hostname* to
- :meth:`~SSLContext.wrap_socket` in order to match the hostname.
+ :meth:`~SSLContext.wrap_socket` in order to match the hostname. Enabling
+ hostname checking automatically sets :attr:`~SSLContext.verify_mode` from
+ :data:`CERT_NONE` to :data:`CERT_REQUIRED`. It cannot be set back to
+ :data:`CERT_NONE` as long as hostname checking is enabled.
Example::
@@ -1691,6 +1694,13 @@ to speed up repeated connections from the same clients.
.. versionadded:: 3.4
+ .. versionchanged:: 3.7
+
+ :attr:`~SSLContext.verify_mode` is now automatically changed
+ to :data:`CERT_REQUIRED` when hostname checking is enabled and
+ :attr:`~SSLContext.verify_mode` is :data:`CERT_NONE`. Previously
+ the same operation would have failed with a :exc:`ValueError`.
+
.. note::
This features requires OpenSSL 0.9.8f or newer.