This project has been created as part of the 1337/42 curriculum by @me, @BusCops and @YbencheL.
This project focuses on building our own HTTP web server from scratch. The goal is to understand how web servers work internally by implementing their core components and handling real HTTP communication.
To better understand the scope of this project, it is important to first define what an HTTP web server is.
HTTP (HyperText Transfer Protocol) is a protocol built on top of TCP/IP. It allows communication between two machines through a request/response model.
HTTP is a stateless protocol, meaning that each request is independent and the connection does not retain information between requests. This is why mechanisms like cookies are used—to simulate stateful behavior on top of a stateless protocol.
In HTTP, client interactions are performed using methods such as GET, POST, DELETE, etc. Each request sent by the client is processed by the server, which then returns a response.
As for the HTTP response, it is mainly composed of two parts:
- A status code (indicating the result of the request)
- A body (the data returned to the client)
FOR more details, check my Medium here
What @me built:
- Multiplier management
- Validation of config file data after parsing
- Request validation
- Full HTTP response construction
- Request routing
- Methods (GET, POST, DELETE)
- Dynamic HTML generation based on error status codes
- Autoindex navigation page
- Testing
What @BusCops built:
- Parsing requests coming from the client browser
- CGI I/O handling
What @YbencheL built:
- Config file parsing
- Cookies and session management
To run the web server, first compile the project using make. This will build the executable webserv, which requires a configuration file as an argument.
You can find example configuration files inside the config_files directory.
-
make
Compiles all source files and generates thewebservexecutable. -
make clean
Removes all object files. -
make fclean
Removes all object files as well as the executable. -
make re
Recompiles the entire project (equivalent to runningmake fcleanfollowed bymake).
run this on the terminal: ./webserv <configuration_file>
run this on the terminal: valgrind --track-origins=yes ./webserv <configuration_file>
For this project, we relied on a combination of personal research and well-known documentation.
One of our teammates, yanflous, created a helpful resource that you can find here:
https://medium.com/@ma1loc/web-d78223b4573a
Since this project revolves around HTTP and web servers, there are many high-quality references available. Here are some of the most useful ones:
- Nginx documentation (configuration and behavior): https://nginx.org/en/docs/
AI tools were mainly used as a sort of an interactive documentation platfrom. They helped us better understand specific concepts, such as how certain components work and how they behave in different scenarios.
Additionally, AI was used for:
- Providing ideas for testing different parts of the project
- Assisting with grammar and wording improvements in this README
AI used as a support tool to enhance understanding and improve documentation quality.
./stress-test
| # | Method | URL | Notes |
|---|---|---|---|
| 1 | GET |
http://localhost:8080/ |
|
| 2 | POST |
http://localhost:8080/ |
Body size: 0 |
| 3 | HEAD |
http://localhost:8080/ |
|
| 4 | GET |
http://localhost:8080/directory |
|
| 5 | GET |
http://localhost:8080/directory/youpi.bad_extension |
|
| 6 | GET |
http://localhost:8080/directory/youpi.bla |
|
| 7 | GET |
http://localhost:8080/directory/oulalala |
Expected 404 |
| 8 | GET |
http://localhost:8080/directory/nop |
|
| 9 | GET |
http://localhost:8080/directory/nop/ |
|
| 10 | GET |
http://localhost:8080/directory/nop/other.pouic |
|
| 11 | GET |
http://localhost:8080/directory/nop/other.pouac |
Expected 404 |
| 12 | GET |
http://localhost:8080/directory/Yeah |
Expected 404 |
| 13 | GET |
http://localhost:8080/directory/Yeah/not_happy.bad_extension |
|
| 14 | POST |
http://localhost:8080/directory/youpi.bla |
Body size: 100,000,000 |
| 15 | POST |
http://localhost:8080/directory/youpla.bla |
Body size: 100,000,000 |
| 16 | POST |
http://localhost:8080/directory/youpi.bla |
Body size: 100,000 · Special headers |
| 17 | POST |
http://localhost:8080/post_body |
Body size: 0 |
| 18 | POST |
http://localhost:8080/post_body |
Body size: 100 |
| 19 | POST |
http://localhost:8080/post_body |
Body size: 200 |
| 20 | POST |
http://localhost:8080/post_body |
Body size: 101 |
| 21 | GET |
/ |
5 workers × 15 requests |
| 22 | GET |
/ |
20 workers × 5,000 requests |
| 23 | GET |
/directory/nop |
128 workers × 50 requests |
| 24 | POST |
/directory/youpi.bla |
20 workers × 5 requests · Body size: 100,000,000 |
✅ All tests passed!
siege -c 255 -t 1s http://localhost:8080
| Metric | Result |
|---|---|
| Availability | 100.00% |
| Transactions | 7,332 hits |
| Elapsed Time | 1.97 s |
| Data Transferred | 183.52 MB |
| Response Time | 64.44 ms |
| Transaction Rate | 3,721.83 trans/sec |
| Throughput | 93.16 MB/sec |
| Concurrency | 239.85 |
| Successful Transactions | 7,332 |
| Failed Transactions | 0 |
| Longest Transaction | 320.00 ms |
| Shortest Transaction | 0.00 ms |
Tested with 255 concurrent users over 1 second — zero failures recorded.