Skip to content

Commit 6c58bc9

Browse files
committed
Support HTTP/2
1 parent 918dae6 commit 6c58bc9

16 files changed

Lines changed: 2551 additions & 19 deletions

File tree

docs/concepts/http2.md

Lines changed: 588 additions & 0 deletions
Large diffs are not rendered by default.

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Until recently Python has lacked a minimal low-level server/application interfac
4242
async frameworks. The [ASGI specification](https://asgi.readthedocs.io/en/latest/) fills this gap,
4343
and means we're now able to start building a common set of tooling usable across all async frameworks.
4444

45-
Uvicorn currently supports **HTTP/1.1** and **WebSockets**.
45+
Uvicorn currently supports **HTTP/1.1**, **HTTP/2**, and **WebSockets**.
4646

4747
## Quickstart
4848

docs/settings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Using Uvicorn with watchfiles will enable the following options (which are other
9292

9393
* `--loop <str>` - Set the event loop implementation. The uvloop implementation provides greater performance, but is not compatible with Windows or PyPy. **Options:** *'auto', 'asyncio', 'uvloop'.* **Default:** *'auto'*.
9494
* `--http <str>` - Set the HTTP protocol implementation. The httptools implementation provides greater performance, but it not compatible with PyPy. **Options:** *'auto', 'h11', 'httptools'.* **Default:** *'auto'*.
95+
* `--http2` - Enable HTTP/2 support. Requires the `h2` package (`pip install h2`). When enabled, HTTP/2 is available via ALPN negotiation over TLS (h2) and via cleartext upgrade (h2c). See the [HTTP/2 documentation](concepts/http2.md) for details. **Default:** *False*.
9596
* `--ws <str>` - Set the WebSockets protocol implementation. Either of the `websockets` and `wsproto` packages are supported. There are two versions of `websockets` supported: `websockets` and `websockets-sansio`. Use `'none'` to ignore all websocket requests. **Options:** *'auto', 'none', 'websockets', 'websockets-sansio', 'wsproto'.* **Default:** *'auto'*.
9697
* `--ws-max-size <int>` - Set the WebSockets max message size, in bytes. Only available with the `websockets` protocol. **Default:** *16777216* (16 MB).
9798
* `--ws-max-queue <int>` - Set the maximum length of the WebSocket incoming message queue. Only available with the `websockets` protocol. **Default:** *32*.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ nav:
5454
- Concepts:
5555
- ASGI: concepts/asgi.md
5656
- Lifespan: concepts/lifespan.md
57+
- HTTP/2: concepts/http2.md
5758
- WebSockets: concepts/websockets.md
5859
- Event Loop: concepts/event-loop.md
5960
- Deployment:

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dependencies = [
4040
[project.optional-dependencies]
4141
standard = [
4242
"colorama>=0.4; sys_platform == 'win32'",
43+
"h2>=4.0.0",
4344
"httptools>=0.6.3",
4445
"python-dotenv>=0.13",
4546
"PyYAML>=5.1",

0 commit comments

Comments
 (0)