ronfire is a minimal asynchronous static file server built using Rust and Tokio, communicating over a Unix domain socket. It serves files from a local static/ directory using a simplified HTTP protocol.
- Asynchronous I/O via
tokio - Uses a Unix domain socket (not TCP)
- Serves static files (HTML) from a
static/directory - Basic
GETrequest parsing - Returns
404 Not Foundfor missing files Mime-Typeguessing- Sanitizes path traversal attempts
- Rust (edition 2021)
- Unix-like OS (Linux/macOS)
- Tokio runtime (
[dependencies] tokio = { version = "1", features = ["full"] })
mkdir static
echo "<h1>Hello, world!</h1>" > static/index.htmlcargo run -- /tmp/ronfire.sockThis will:
- Remove any existing socket file at
/tmp/ronfire.sock - Start listening for HTTP-like requests over the socket
Use curl or similar tools:
curl --unix-socket /tmp/ronfire.sock http://localhost/Expected output:
<h1>Hello, world!</h1>GET /index.html HTTP/1.1
Host: localhost
HTTP/1.1 200 OK
Content-Length: 27
Content-Type: text/html
<h1>Hello, world!</h1>
If the file is missing:
HTTP/1.1 404 Not Found
Content-Length: 22
Content-Type: text/html
<h1>404 Not Found</h1>
- Only handles basic
GETrequests.
MIT