#server #http

claro

A classic multi-threaded HTTP server

3 releases (breaking)

0.3.0 Dec 16, 2024
0.2.0 Nov 30, 2024
0.1.0 Nov 26, 2024

#213 in HTTP server

Download history 130/week @ 2024-11-22 163/week @ 2024-11-29 22/week @ 2024-12-06 117/week @ 2024-12-13 12/week @ 2024-12-20

154 downloads per month

MIT license

135KB
2.5K SLoC

claro

⚠️ Work in progress ...

A simple, predictable HTTP/1.1 server

Hello world

use claro::{Response, Request};

let server = claro::listen("localhost:0", |_: &mut Request| {
    Response::plain_text("Hello, world!")
}).unwrap();

// use server.wait() to block until the server terminates
server.stop();

This library will be interesting to you if any of the following describe you:

  • You need a simple http server for your static site generator.
  • You are going to be putting your service behind a reverse proxy, so it does not need to speak anythinmg other than http/1.1
  • You despair at the lack of maintained non-async http servers in the Rust ecosystem.

Turn around if:

  • You expect that what your are building will need to maintain a "high" number of concurrent connections (what "high" here means is TBD).

Dependencies

~4–11MB
~103K SLoC