Skip to content

About

Minimal implementation of a HTTP/1.1 server in Rust

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

137 Commits

Folders and files

Repository files navigation

Mini-HTTP Server Banner

Mini-HTTP Server

This is a multi-threaded HTTP/1.1 server written in Rust.

I have written two accompagnying blog posts to this project:

Features

This server supporst the following path operations:

  • /user-agent: returns the client's User-Agent header.
  • /echo/<string>: echos the provided string back.
  • /sleep: waits for 10s and returns 'Good sleep!' (used to test concurrency).
  • <path> or /files/<path>: support GET and POST requests to read or write files in the server's data directory.
  • /files/<path>: support both downloading (GET) and uploading (POST) files within the server's data directory.
  • /<path>: general path handler to support hosting a website.
    • If the path is empty (the root /), it looks for index.html.
    • If index.html is missing, it automatically generates a directory listing (index) of the data folder.

Note: security checks are performed to prevent path traversal attacks.

Running the Server

  1. Compile the Rust program into an executable:
cargo build --release
  1. Run the executable:
./target/release/flyweight-http-server

About

Minimal implementation of a HTTP/1.1 server in Rust

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages