Metadata-Version: 2.4
Name: echocorn
Version: 1.0.5
Summary: Fast asyncio ASGI server with HTTP/1.1 and HTTP/2 support
Home-page: https://github.com/mishakorzik/echocorn
Author: MishaKorzhik_He1Zen
Author-email: developer.mishakorzhik@gmail.com
License: Apache 2.0
Project-URL: Bug Tracker, https://github.com/mishakorzik/echocorn/issues
Project-URL: Donate, https://www.buymeacoffee.com/misakorzik
Keywords: asgi,async,asyncio,uvloop,websocket,websockets,wsgi,fast,http,http2,h11,h2,https,hsts,tls,server,secure,dualstack
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: 3.16
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Framework :: AsyncIO
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Environment :: Web Environment
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: h2>=4.1.0
Provides-Extra: uvloop
Requires-Dist: uvloop>=0.17; platform_system != "Windows" and extra == "uvloop"
Provides-Extra: test
Requires-Dist: pytest>=7; extra == "test"
Requires-Dist: httpx>=0.24; extra == "test"
Requires-Dist: starlette>=0.27; extra == "test"
Requires-Dist: quart>=0.19; extra == "test"
Requires-Dist: flask>=3; extra == "test"
Requires-Dist: asgiref>=3.6; extra == "test"
Requires-Dist: websockets>=12; extra == "test"
Requires-Dist: cryptography>=41; extra == "test"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Echocorn

Fast, lightweight ASGI server with HTTP/1.1, HTTP/2 and WebSockets. For FastAPI, Starlette, Django, Quart and others.

## Install

Python 3.11+:

```bash
pip install echocorn
pip install "echocorn[uvloop]"  # faster loop, no Windows
```

## Quick start

`echocorn.toml` next to your app:

```toml
app = "app:app"  # or "127.0.0.1:5000" for proxy mode

[server]
host = "0.0.0.0"
port = 8000
workers = 4
```

```bash
echocorn --config echocorn.toml
```

Full example with comments: [`echocorn.toml`](echocorn.toml).

Python API:

```python
from echocorn import ASGIServer, ServerConfig
ASGIServer(app, ServerConfig(host="127.0.0.1", port=8080)).run()
# or: await server.serve()
```

Flask (WSGI) needs one line:

```python
from asgiref.wsgi import WsgiToAsgi
app = WsgiToAsgi(app)
```

## Features

* HTTP/1.1 (keep-alive, chunked, 100-continue, trailers) and HTTP/2 (ALPN, h2c, flow control, GOAWAY).
* WebSockets (`ws/wss`, subprotocols, ping/pong, fragmentation).
* gzip/deflate, `Vary: Accept-Encoding`.
* Strict framing (no smuggling), header injection protection, `safe_headers`, `bind_domain`.
* Timeouts, limits, rate limiting (`429 + Retry-After`), graceful shutdown.
* HTTP->HTTPS redirect and reverse-proxy mode (`app = "127.0.0.1:5000"`).

Proxy example:

```toml
app = "127.0.0.1:5000"

[server]
port = 443

[tls]
certfile = "cert.pem"
keyfile = "key.pem"

[redirect]
enabled = true
port = 80
```

Only local upstreams allowed (`127.0.0.0/8`, `10/8`, `192.168/16`, `::1`, ...). `X-Forwarded-*` is replaced, never appended.

## CLI

```
usage: echocorn --config PATH
  --config PATH   config file (required)
  -h, --help
  --version
  --about
```

## Production notes

* TLS 1.2+, tune `somaxconn`, file descriptors, monitoring.
* Set `max_request_size`, `request_timeout`, `[ratelimit]` for public services.
