a very basic http server, written in c++
No followers yet
Once you ship this you can't edit the description of the project, but you'll be able to add more devlogs and re-ship it as you add new features!
Worked on a few things before getting started on directory listing since I'd rather deal with those now than later.
Added custom document root dir option to .env so you can choose a different folder other than the default public/.
Added a custom 404 page option, if one provided it'll return 404 with the given html page, if not, it'll return a plain 404 error.
Also added timestamps to the request logs.
Hoping to get started on directory listing next, maybe I'll work on some other stuff before though.
Small changes, I decided to only move the config loading logic to a separate file for now, as I don't see a need to split anything else (and also moved source code to src/ + added makefile), and moved site root dir to public/ by default, planning on adding a config option for changing this though. I might also work on directory listing next, something similar to what Apache does.
The pages load properly now on firefox, adding proper headers with content-type, content-length, and etc fixed the problem.
Added looping accepts so the server doesn't exit after one request.
Added args to the main loop, right now the only accepted arg is --port for choosing another port other than the default 8080, and a .env loader as well, which also can be used to set the port, but can be overriden via args.
Added graceful exits via signals, so when you press ctrl-c, it'll exit gracefully, and fixed the ip shown in the request received message along with that, and finally added basic content types for js, css, etc so browsers can properly load these.
I'll probably move the site root files to a public/ folder instead of those being in the root of the project as the next change, and I might as well consider splitting the code into multiple files for readability.
I got the server to work with curl somewhat for now, but attempting to view the page via a browser will just return The connection was reset, so that's something I'll have to work on. Also added basic error checks, but overall this still needs a lot of work to be functional.
I decided to challenge myself and also learn c++ by making a http server. I originally had the idea of what if I made the xbox 360 run a http server, but since I don't have access to a windows pc or visual studio 2010 ultimate right now, I just decided to make a regular http server. This will also be my first c/c++ project despite using c before.