Trust me, I don't know what I'm doing either
It's January 27th, 2025 as I write this. HTTP servers are ubiquitous at this point. If you need one, Apache is a wonderful open-source (and free) option. Or if Apache isn't your thing, there's still plenty of other options.
So it would be asinine to make your own. It would be ludicrous to design your own in a language that has for most application purposes, been superseded by other languages.
Hi, I'm Chris.
>Asinine, ludicrous, and probably mad.
To be clear, I have never done this before. I have never done anything like this. So why do something like this now, in 2025?
Optimistically, because doing things you don't know how to do is how you grow. We never would have walked as babies otherwise.
Pessimistically, because there's probably some unresolved masochism going on.
Let's get into it!
On it's face, this project doesn't seem overly complicated (famous last words there).
An HTTP server runs inside of a machine, listening on specified network ports (80 for HTTP and 443 for HTTPS).
When a HTTP request is received on one of those ports, the server looks up the request URI from its available documents, and if a match is found, returns that page along with the HTTP 200 status code.
Otherwise, you get an error message, and the server instead returns a code indicating the general issue.
How hard can that be? The HTTP protocol itself originally was laid out in RFC 2616 which goes into the very gory technical details. There's a few RFCs as well,
that have built on the standard and added further response codes, or similar features. But I think RFC 2616 is a good place to start.
I've created a github repository to track what I write. While it's a little basic currently, so is everything when you start.
The final update for today is going to be the 2 books that I'm dreaming will lead me to victory on my quest (or atleast give me a fighting chance before my inevitable destruction)
1. The C Programming Language, 2nd Edition
&
2. Beej's Guide to Network Programming
And that's it for today. So far, as projects go we've created a base to build from, and we haven't caught anything on fire. For most projects, that's a strong start. If you've gotten this far, hopefully by the time you're reading this
I'll have finished at least another article, but if not go grab a coffee, and watch the world spin for a while.
Thanks -