Skip to content

Writing our own HTTP server in C++.

Notifications You must be signed in to change notification settings

fkoolhoven/webserv

 
 

Repository files navigation

logo

Writing our own HTTP server in C++.

About the project

A project made in accordance with the Webserv project which is part of the Codam Core Curriculum. This project was a collaboration between with Marès Verbrugge, Flen Huisman and Felicia Koolhoven. We created our own HTTP server in C++, following HTTP 1.1 and taking nginx as an example. HTTP is one of the most used protocols on the internet. We tested our webserv in a browser (Firefox).

Getting started

Start by cloning the repository:

git clone https://github.com/maresverbrugge/webserv.git

Go into the minishell directory and compile by using make:

make

Usage

Webserv takes as input a configuration file, similar to an nginx configuration file. It contains directives such as host (e.g. localhost), port (e.g. 8080) and route (e.g. /pages). See the config folder for examples or read the subject to find the configuration file requirements. To use our default configuration:

./webserv config/default.conf

You can then make request through the browser. For example:

http://localhost:8081/

Important features

You can find all the requirement we had to meet in the subject. Our webserv:

  • Is compatible with at least Mozilla Firefox
  • Can serve a fully static website
  • Handles GET, POST and DELETE requests
  • Uses epoll to efficiently manage requests
  • Will provide accurate HTTP response status codes and error pages
  • Allows you to upload and delete files on specified locations
  • Can execute CGI, for example to generate an HTML page through a Python script

Important learnings

This was the first group project we did in C++. We gained knowledge on:

  • Object-oriented programming, designing classes
  • I/O multiplexing using epoll
  • HTTP requests and responses
  • The inner workings of webservers
  • Writing reliable parsers in C++
  • Using Git and GitHub in a collaborative way
  • Concurrent programming (to handle CGI)
  • Modern C++ and smart pointers
  • HTML, CSS and JavaScript (for our test web pages)
  • Python (for our CGI scripts)

Contact

See our profile pages for ways to contact us!

About

Writing our own HTTP server in C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 87.1%
  • HTML 4.1%
  • Python 3.6%
  • Makefile 2.6%
  • CSS 1.6%
  • JavaScript 0.8%
  • Dockerfile 0.2%