Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 12d0941

Browse files
committed
Fix the documentation on overriding the SSL context
I completely botched that one. It seemed to work, but it was falling back to HTTP/1.1. And I missed hyper.tls.init_context.
1 parent 8a95ad6 commit 12d0941

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

docs/source/advanced.rst

+7-4
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ SSL/TLS Certificate Verification
7272
By default, all HTTP/2 connections are made over TLS, and ``hyper`` bundles
7373
certificate authorities that it uses to verify the offered TLS certificates.
7474

75-
You can change how certificates are verified by passing your own
76-
``ssl_context`` to the :class:`HTTPConnection <hyper.HTTPConnection>`.
77-
For example, this will disable verification altogether::
75+
You can change how certificates are verified by getting a new SSL context
76+
from :func:`hyper.tls.init_context`, tweaking its options, and passing it
77+
to the :class:`HTTPConnection <hyper.HTTPConnection>`. For example, this will
78+
disable verification altogether::
7879

7980
import ssl
80-
context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
81+
context = hyper.tls.init_context()
82+
context.check_hostname = False
83+
context.verify_mode = ssl.CERT_NONE
8184
conn = HTTPConnection('http2bin.org:443', ssl_context=context)
8285

8386
Streaming Uploads

0 commit comments

Comments
 (0)