C++ Web Server on my custom hobby OS

https://news.ycombinator.com/rss Hits: 13
Summary

DemoAfter a long break from working on my hobby operating system, I finally got back into it and finished a very important milestone: a working web server. Web browser accessing HTTP server on my OS Networking was always integral to my hobby project. The first goal was getting the basic networking stack working: Ethernet, IP, ARP, UDP, TCP, DHCP and DNS. Besides TCP this was rather straightforward, but when moving onto HTTP things broke. First time getting TCP to work. Networking stack codeThis led to my first break from the project, but also left a nagging thought in my mind, wanting to make it work. I finally sat down and started debugging. I eventually found the culprit after hours of dissecting my own code, the problem was a broken implementation of the terminal buffer, overwriting a lock in another process… fun. Additionally, the E1000 network driver did not correctly handle incoming packets, which I finally got working by handling bursts of packets.Performance and hardeningAfter getting an HTML page returned from the web engine I started noticing lots of performance errors and hangs from TCP, mainly because quickly refreshing the browser led to a spam of RST packets which were not handled correctly.After a few hours of tinkering I finally got the RST packets working and the network stack is now able to handle a packet spam from the browser.The HTTP EngineNext step was actually implementing a HTTP engine, parsing the requests from the user. Before this engine I simply returned a static HTTP response no matter the actual request.Keeping with the spirit of this hobby OS I want to write everything from scratch, luckily I already had implemented a pretty complete HTTP parser for my other project c-web-modules. So I extracted the HTTP parser as a standalone library and ported it to my OS.The Web Engine.After the HTTP engine was done I moved onto the web engine, focusing on something small, rather than big and fancy. Mainly routing was important and adding route hand...

First seen: 2025-11-28 17:41

Last seen: 2025-11-29 05:43