Skip to content

Writing our own HTTP server. A collaborative 42/Codam project

Notifications You must be signed in to change notification settings

MichelleJiam/foodserv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

foodserv

webserv is a 42/Codam project about writing our own HTTP server in C++
This is a collaborative project between nhariman, salbregh, and mjiam.

Content

Description

This is a simple HTTP/1.1 web server that can handle GET, POST, and DELETE requests.

Our webserver uses the same non-blocking, event-driven architecture that nginx does. This allows the server to handle a high amount of requests with speed.
We use kqueue to handle the multiplexing, which means the server can only run on Mac machines.

Detailed project specifications can be found here.

Usage

Configuration

The server settings are configured through a .conf configuration file based on Nginx. The list of accepted directives can be found here.

Build

From the root of the repo, run make && ./webserv to build and start the web server.
The webserv executable takes an optional configuration file argument:

$ ./webserv [your_config_file.conf]

Otherwise the web server defaults to using the settings in config_files/default.conf.

Use

The web server can be interfaced with through any browser or tools like curl and telnet.
If using the default configuration, navigating to localhost on port 80 (default), 4242, and 8080 showcases 3 different websites with different configuration settings.

http://localhost/

  • Standard functionality

http://localhost:4242/

  • Internal and external redirects

http://localhost:8080/

  • Custom error pages
  • Autoindexing

Documentation

We made a wiki containing information about:

  • project requirements
  • server specs
  • implementation and research notes
  • code documentation

Non-Goals

  • Persistent connections
  • Accepting POST file uploads other than text files

Resources

Testing

  • Testing was done using GoogleTest. Our tests can be found in the google_test folder.
  • A script for quickly setting up and running GoogleTest was prepared by Michelle. It requires CMake to be installed.

General info on programming web servers

Sockets

Kqueue

Nginx

Requests

CGI

RFC

About Us

Michelle Jiam - LinkedIn / Github
Sanne Albreghs - LinkedIn / Github
Niks Hariman - LinkedIn / Github

Languages

  • C++ 69.3%
  • HTML 14.4%
  • CSS 5.0%
  • Perl 4.4%
  • CMake 3.9%
  • Shell 1.9%
  • Other 1.1%