webserv

C++ | HTTP | SOCKETS

About the project

It was a huge group project and we were 2 working on it.
We had to build a non blocking HTTP 1.1 server, written in C++ 98 and conditionally compliant with the HTTP RFC 7230 to 7235.

What I learned

Sockets

Using a configuration file that we would parse, our server had to connect and listen on some specific ports.
Through a personal project, I had already used sockets in a websocket protocol, for example using socket.io in Node.JS but this project was totally different.
We had to use low level C sockets functions and on the top of that sockets had to be non-blocking. If you want to read more about these I'd strongly recommend this website.

Hypertext TransferProtocol (HTTP)

We went through a lot of HTTP headers which allowed me to grasp the importance of each and every one of them.

NGINX

In the subject, nginx was considered HTTP 1.1 compliant and could be used to compare headers and answer behaviors.
In order to test our server, I dug in nginx documentation and tested their server as well.
Note also that nginx source code is written in C and publicly available on github.

CGI

Common Gateway Interface (CGI) was a great part of this project.
I knew nothing about it but I found it really interesting.
To summarize, we launch a new process to execute a program that will interpret the request and handle the related file.
A common example would be the PHP CGI to display a web page when navigating on an .php link.

Notes

This project took us way longer than expected because of the COVID-19.
Nevertheless, I enjoyed working on it because I learned enormously.