Repository navigation
Releases
mojo-http 0.0.5
Three security fixes, a Host field that is checked, and a build that prints no warnings from the library.
Security
- Static files.
Staticheld a file's name to its root and then opened the file by that name: someone able to write under the root could swap the entry for a symlink in between and be sent a file from outside it. Each opened file is now checked for where it really is, and nothing is sent from one outside the root. An empty root, which served every path on the machine, serves nothing. On Linux, serving static files now needs/proc. - PostgreSQL. With no
sslmodethe driver connected as libpq'spreferdoes, and would send the password in clear text to whoever answered. A database on another machine is now verified (verify-full): one that declines TLS, or shows a certificate this machine doesn't trust for its name, is refused before anything is sent. A database on this machine (a loopback address) connects as before. A database on another host without such a certificate now needssslmode=disable,preferorrequirein its URL. - Rate limits.
RateLimitlet a request through uncounted when its table had no free place near the client's, and withby_headera caller could arrange that. Such a client is now counted from where its least-used neighbour stands, and where a client is counted can't be worked out from outside. Several limiters on one application give a response one set ofRateLimit-*fields.
Also
- A
Hostthat is not a host and perhaps a port is answered 400 (RFC 9112 3.2); HTTP/2 and HTTP/3 hold:authorityandhostto the same rule. Statichears a file changed through another hard link.- A program built against the library gets no compiler warnings from it.
- The HttpArena entries, as they are submitted.
The full list is in CHANGELOG.md.
Packages
pip install mojo-http-asgi(Linux x86-64, glibc 2.35 or later, a CPU with AVX2). The wheel is attached with its SHA-256; it is the file on PyPI, built and checked on a runner from this tag.- The library and its compiler as conda packages, in the channel
https://prefix.dev/drobertson-dev/mojo-http.
mojo-http 0.0.4
The first public release.
mojo-http is an HTTP server, async runtime and FastAPI-shaped framework written in Mojo, with an ASGI bridge that serves Python applications from it. It is built by the project's own toolchain: Mojo 1.2 with this project's fixes to the compiler and standard library, pinned in the repository and fetched by pixi run toolchain-install.
What it includes
- The server: HTTP/1.1, HTTP/2 and HTTP/3 over QUIC, WebSockets over all three, gRPC, native TLS 1.3 on AWS-LC primitives, a reverse proxy, static files, templates.
- The runtime: worker-local tasks with join, cancellation, timers and bounded channels, on epoll or io_uring.
- The API layer: endpoint structs whose fields are their inputs, JSON and validation by reflection, FastAPI's error format, OpenAPI and Swagger UI, a
TestClient. - Middleware: hooks around any application or one async wrapper; CORS, trusted hosts, an https redirect, signed sessions, rate limits, request ids and security fields ship with it.
- Clients: outbound HTTP/1.1 and HTTPS, PostgreSQL and Redis.
The README has the whole list and the quick start; CHANGELOG.md has what changed in 0.0.4.
The ASGI wheel
mojo-http-asgi runs a FastAPI or Starlette application unchanged, as uvicorn does, on CPython 3.12, 3.13, 3.14 and free-threaded 3.14t:
pip install mojo-http-asgi
mojo-http main:app --port 8000 --workers 4It is for Linux x86-64 (glibc 2.35 or later, a CPU with AVX2). The wheel is attached here with its SHA-256; it is the file on PyPI, built and checked on a runner from this tag.
Platforms
Linux x86-64. Linux ARM64 and Apple Silicon macOS follow when the toolchain is built for them.
Toolchain 1.2.0-74cc16e4e197
Mojo 1.2.0 built from Modular's source (tag mojo/v1.2.0) with this project's fixes to the compiler and standard library (toolchain/: 46 patches, and one to the Linux driver), as an archive that is used by unpacking it. It is built by this project and is not a release of Modular Inc.
This is not a release of mojo-http itself: it holds the compiler that toolchain/dist.lock.json pins, for pixi run toolchain-install and for CI.
| Platform | Archive | SHA-256 |
|---|---|---|
| linux-64 | mojo-http-toolchain-1.2.0-74cc16e4e197-linux-64.tar.xz |
cb61f52774b14bcb1f00eafec64b4fcd45aa2cce6ac67019e9aea0332637d1ca |
Needs glibc 2.35 and GCC 12's libstdc++ (Ubuntu 22.04, Debian 12 or later) and a cc to link with. The README inside (share/mojo-http-toolchain/README.md) says the rest.