#server #http

claro

A classic multi-threaded HTTP server

5 releases (breaking)

new 0.5.0 Jan 20, 2025
0.4.0 Jan 20, 2025
0.3.0 Dec 16, 2024
0.2.0 Nov 30, 2024
0.1.0 Nov 26, 2024

#292 in HTTP server

Download history 57/week @ 2024-11-20 230/week @ 2024-11-27 16/week @ 2024-12-04 109/week @ 2024-12-11 32/week @ 2024-12-18 3/week @ 2025-01-08 98/week @ 2025-01-15

101 downloads per month

MIT license

140KB
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
~104K SLoC