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>]
gmake
on Mac/BSD)brew install libmagic
on Mac, should be preinstalled on Linux/BSD)apt install apache2-utils
on debian/ubuntu)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.
sleep(10)
in handle_request
adds a response time of 18 seconds