Welp, I just completed a second iteration of the HTTP server. I moved on to modeling actual structs and responses.
- I implemented safe parsing of the Request Line (Method, Route, HTTP Version).
- I handled errors defensively for malformed headers, and corrupt Content-Length values no longer crash the server.
- I built the responses more cleanly using maps and headers.
This is actually fun!
Less than 200 lines, and the code is already looking clean 🤯
I had the day off from work today, so I decided to do something different.
I built an HTTP server from scratch in Go to understand what really happens under the hood before a framework returns a fancy response.
In this first iteration, I managed to set up a TCP listener, handle…
GitHubGitHub - Petox03/malport: An attempt to build an HTTP server “from scratch” using the net library in GoAn attempt to build an HTTP server “from scratch” using the net library in Go - Petox03/malport
commit a0be46d