skvconf - A configuration file parser

Introduction I have been programming in various languages for quite some time now but have found myself coming back to C and rust the most. One small problem I had with C however was adding configuration capabilities to my applications. In rust I always just used the toml crate but that didn’t work in C. So I ended up writing very simple parsers for these projects. This was of course not very scalable and also had ugly configuration syntax as a side effect. Eventually, I decided to write a dedicated library that I could embed into my applications when needed. This library would focus on having a good configuration language as the base and would handle parsing and the rest. ...

April 21, 2024 · 6 min · Moritz Sokoll

Writing a web server in C

Introduction A while ago I started work on a web server written in C. The project is available here. Before I had written a web server in rust (found here) so I was a bit familiar with HTTP and since this wasn’t my first ever C project I of course knew a bit about basic file handling and error handling. The main new things to learn where the following: Working with sockets Using a thread pool with: Worker threads An event queue for incoming requests Parsing a configuration file Technical details Sockets While I was somewhat familiar with sockets I hadn’t used them in C (I used them in a small python web server). This turned out not to be a big problem. The harder part was the protocol parsing but I restricted myself to HTTP/1.1 connections that close immediately after being processed. And I didn’t look into non-blocking sockets. This is one of the things I might explore later in a smaller form factor and then either try to work into this project or write a new one from scratch. ...

April 17, 2024 · 3 min · Moritz Sokoll