Servers static files and prevents path traversal attacks. Will probably crash if you try anything fancy.
However, it handles requests at about 10 msec/response, which is comparable to Nginx.
Try ab -n 1000 -c 100 localhost:8080/
for a comparison.
$ ./main -h
usage: ./main [<port>] [<host>]
- make (or
gmake
on Mac/BSD) - a C compiler. clang is the default, change CC=gcc in the makefile if you don't want to install it.
- libmagic (
brew install libmagic
on Mac, should be preinstalled on Linux/BSD)
- sed/grep
- curl
- ab (
apt install apache2-utils
on debian/ubuntu) - clang-tidy
- cppcheck
- bash and bats
make test
valgrind --leak-check=full build/main 8080
Run a few queries and see if there's any memory leaks.
I'm taking networking and operating systems courses where we don't write any code. I thought it would be nice to get hands-on in system internals.
This project is licensed under the BSD 3-Clause license. See LICENSE.txt for details.
- Figure out why -fsanitize=thread thinks my interrupt handler isn't safe
- Check what happens if we run into the thread limit (currently, we spawn a thread for every request no matter how many threads we already have)
- Figure out why
sleep(10)
inhandle_request
adds a response time of 18 seconds - Logging (?)
- Dynamic pages (??)
- HTTP/2.0 (???)