| 1 |
.. _http2: |
| 2 |
|
| 3 |
HTTP/2 |
| 4 |
====== |
| 5 |
|
| 6 |
Hypercorn is based on the excellent `hyper-h2 |
| 7 |
<https://github.com/python-hyper/hyper-h2>`_ library. |
| 8 |
|
| 9 |
TLS settings |
| 10 |
------------ |
| 11 |
|
| 12 |
The recommendations in this documentation for the SSL/TLS ciphers and |
| 13 |
version are from `RFC 7540 <https://tools.ietf.org/html/rfc7540>`_. As |
| 14 |
required in the RFC ``ECDHE+AESGCM`` is the minimal cipher set HTTP/2 |
| 15 |
and TLSv2 the minimal TLS version servers should support. By default |
| 16 |
Hypercorn will use this as the cipher set. |
| 17 |
|
| 18 |
ALPN Protocol |
| 19 |
~~~~~~~~~~~~~ |
| 20 |
|
| 21 |
The ALPN Protocols should be set to include ``h2`` and ``http/1.1`` as |
| 22 |
Hypercorn supports both. It is feasible to omit one to only serve the |
| 23 |
other. If these aren't set most clients will assume Hypercorn is a |
| 24 |
HTTP/1.1 only server. By default Hypercorn will set h2 and http/1.1 as |
| 25 |
the ALPN protocols. |
| 26 |
|
| 27 |
No-TLS |
| 28 |
~~~~~~ |
| 29 |
|
| 30 |
Most clients, including all the web browsers only support HTTP/2 over |
| 31 |
TLS. Hypercorn, however, supports the h2c HTTP/1.1 to HTTP/2 upgrade |
| 32 |
process. This allows a client to send a HTTP/1.1 request with a |
| 33 |
``Upgrade: h2c`` header that results in the connection being upgraded |
| 34 |
to HTTP/2. To test this try |
| 35 |
|
| 36 |
.. code-block:: shell |
| 37 |
|
| 38 |
$ curl --http2 http://url:port/path |
| 39 |
|
| 40 |
Note that in the absence of either the upgrade header or an ALPN |
| 41 |
protocol Hypercorn will assume and treat the connection as HTTP/1.1. |
| 42 |
|
| 43 |
HTTP/2 features |
| 44 |
--------------- |
| 45 |
|
| 46 |
Hypercorn supports pipeling, flow control, server push, and |
| 47 |
prioritisation. |