Skip to content

NicolasPllr1/mini-http-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

Manually

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

Automatically

The compile_and_run.sh script automates the 2 steps above.

Simply run:

./compile_and_run.sh`

to get the http-server going!

About

Minimal implementation of a HTTP/1.1 server in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •