Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8cbbbb

Browse files
committed
Issue #20913: make it clear that create_default_context() also enables hostname checking
1 parent c346060 commit f8cbbbb

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/library/ssl.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,7 +1626,8 @@ For **client use**, if you don't have any special requirements for your
16261626
security policy, it is highly recommended that you use the
16271627
:func:`create_default_context` function to create your SSL context.
16281628
It will load the system's trusted CA certificates, enable certificate
1629-
validation, and try to choose reasonably secure protocol and cipher settings.
1629+
validation and hostname checking, and try to choose reasonably secure
1630+
protocol and cipher settings.
16301631

16311632
For example, here is how you would use the :class:`smtplib.SMTP` class to
16321633
create a trusted, secure connection to a SMTP server::
@@ -1641,9 +1642,9 @@ If a client certificate is needed for the connection, it can be added with
16411642
:meth:`SSLContext.load_cert_chain`.
16421643

16431644
By contrast, if you create the SSL context by calling the :class:`SSLContext`
1644-
constructor yourself, it will not have certificate validation enabled by
1645-
default. If you do so, please read the paragraphs below to achieve a good
1646-
security level.
1645+
constructor yourself, it will not have certificate validation nor hostname
1646+
checking enabled by default. If you do so, please read the paragraphs below
1647+
to achieve a good security level.
16471648

16481649
Manual settings
16491650
^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)