10 unstable releases (4 breaking)
Uses old Rust 2015
new 0.5.0 | Apr 7, 2025 |
---|---|
0.4.2 | Feb 19, 2025 |
0.4.1 | Jan 22, 2025 |
0.3.1 | Nov 7, 2024 |
0.1.0 | Jun 6, 2024 |
#2125 in Network programming
29 downloads per month
Used in cafetera
63KB
1.5K
SLoC
🍵 HteaPot HTTP Server
Spanish | English
Hteapot is a powerful, Rust-based HTTP server and library designed for high-performance web applications. Effortlessly serve static files and handle HTTP requests with resilience and speed.
Features
1. Threaded Architecture
Custom thread-based system, capable of handling around 70,000 requests per second.
2. Performance Under Load
Steady performance under high concurrency, managing up to 50,000 requests per second with increased connections.
3. Low Error Rate
- Achieves a near 100% success rate for 200 OK responses during stress tests, demonstrating strong resilience.
- Outperforms others at similar loads, with minimal error rates under extreme concurrency.
4. Streaming Support
- Supports response streaming via chunked transfer encoding, useful for large files or long-lived connections.
Use
standalone http server
You can configure the server using a TOML file. Here's an example configuration:
[HTEAPOT]
port = 8081 # The port on which the server will listen for incoming connections.
host = "localhost" # The host address to bind the server to.
root = "public" # The root directory from which to serve files.
Then running with
$ hteapot ./config-file.toml
or serving a file or folder directly
$ hteapot -s ./public/
Library
For use hteapot as a library in rust
- Install the library
$ cargo add hteapot
- Then you can use it in your project
use hteapot::{HttpStatus, HttpResponse, Hteapot, HttpRequest};
fn main() {
let server = Hteapot::new("localhost", 8081);
server.listen(move |req: HttpRequest| {
HttpResponse::new(HttpStatus::IAmATeapot, "Hello, I am HTeaPot", None)
});
}
Build
- Clone the repository:
git clone <repository_url>
- Build the project:
cargo build --release
Run the server with a configuration file:
Copy code
./target/release/hteapot <config_file_path>
Roadmap
- HTTP/1.1 support (keep-alive, chunked encoding)
- Multipart form handling
- Basic routing
- Library support (use as a crate)
- Streaming responses
- HTTPS support
- Compression (gzip/deflate)
- WebSocket support
- More modular architecture and documentation
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.