Photo by ThisisEngineering RAEng

Multi Threading

Nisse In the first three articles, we created a very basic Web Server. A significant issue with this simplistic server is that it can only handle connections serially. This article introduces a thread pool that will handle the actual requests. The main thread will accept new requests and create the work items to be handled by the thread pool. NisseV4 All the code for this article is in the directory V4 directory. It uses standard libraries and thors-mongo. If you have a Unix-like environment, this should be easy to build; if you use Windows, you may need extra work. A “Makefile” is provided just as an example. ...

November 12, 2024 · 8 min · Loki Astari, (C)2024
Photo by Possessed Photography

SSL Certificates

Nisse In the previous article, “C++ Sockets,” I mentioned that Thors-mongo had built-in support for SLL connections but glossed over the details. In this article, we will review the necessary additions. From the server side, you need an SSL certificate. But what is an SSL certificate, and how do you obtain one? SSL Certificates The SSL certificate has two primary purposes. Securely encrypt all traffic between the client and server. Provides trust that you are talking to a server on the requested domain. The Basics Trusted certificate authorities issue SSL certificates and contain information that validates the certificate cryptographically. When a browser connects to a website, the server returns the certificate, which includes crucial information such as the issuing company. Before establishing a secure connection, the browser validates the certificate against the issuing company’s SSL certificate to ensure it is not forged. If the issuing company is a subsidiary, it recursively looks up the parent company that issued the certificate and validates their certificates until it reaches a root certificate. This process creates a chain of trust leading to a known trusted root certificate. ...

November 10, 2024 · 6 min · Loki Astari, (C)2024
Photo by Roman Synkevych

C++ Sockets

Nisse In the previous article “A Web Server,” I created the simplest web server possible. This article covers the next stage by addressing the issues related to low-level socket programming. To be honest, we are going to take a shortcut. Dealing with ‘*nix’ variants is complex enough, but adding Windows systems makes the process exceedingly complicated (and thus beyond the scope of this article). Here, we will introduce a C++ library to abstract the socket layer and provide a higher-level interface. ...

November 8, 2024 · 3 min · Loki Astari, (C)2024
Photo by Ken Blode

A Web Server

Nisse Describing all aspects of Nisse in a single article would be complex and overwhelming. I want to start with a beginner’s perspective and address a real-world problem many beginners attempt. I will identify some of the issues and introduce solutions one at a time, ultimately leading to the final library, which is Nisse. The simplest web application I can build is a web server. A web server maintains no state between calls, and the interface is straightforward. The client sends an HTTP message and, in return, receives an HTTP response. ...

November 6, 2024 · 6 min · Loki Astari, (C)2024
Photo by ThisisEngineering RAEng

Nisse - Origins of a Server Library

Nisse Nisse is a C++ library that simplifies the creation of C++ web-based applications. It provides a framework for handling incoming requests and executing user-defined code asynchronously. To achieve this, Nisse creates managed socket connections that can be utilized by user code. It will automatically suspend the execution of user code and RE-USE the thread if the user code blocks during a read/write operation on a connection, thus offering easily accessible asynchronous functionality. ...

November 4, 2024 · 2 min · Loki Astari, (C)2024