This project has been created as part of the 42 curriculum by 0yech, stellaaa.sh.
webserv is an HTTP web server capable of serving static websites, as well as calling CGI scripts.
It is entirely implemented in C++98, alongside several POSIX functions, including the Linux-exclusive epoll polling function.
As such, this project is Linux-centric, and will likely not work on MacOS or Windows operating systems.
- Dynamic configuration based on configuration files
- Listening on multiple ports at a time
- Listening on multiple addresses at a time
- I/O multiplexing using
epoll - Connection timeouts
- Static website distribution
- CGI Script execution and results distribution (bring your own interpreter)
- File uploads
- Multiple HTTP methods: GET, POST and DELETE all available
- HTTP redirection
- Directory listings for easy browsing of resources
- GNU Make
- A Linux operating system with
epollsupport.
- Clone the repository on your machine
- Run
maketo compile the project. Awebservbinary will be generated. - Use
./webserv path/to/config/fileto run your web server. Multiple configuration files examples are available in theconfig/directory. - You will then be able to access the web server through the ports and addresses defined in your configuration file. Use
telnet,curlor a web browser to explore the resources and locations.
Use config/1.conf for an all-rounder configuration that will allow you to test several features of our web server.
For example, using the 1.conf example:
http://127.0.0.1:8080/: Gives you the webserv tester, a panel useful to try a few things out, including POST requests and CGI.http://127.0.0.1:8080/images: Gives you a directory listing of thehtml/resources/imagesfolder that you can explore freely.http://127.0.0.1:8080/cgi-bin/script.py?key=value: Gives you an example of a Python CGI script running.
- RFC 1945 - The HTTP 1.0 standard, for the core functionality of HTTP, the how it works, not what it means (the semantics).
- RFC 9112 - The HTTP 1.1 standard, for when we need to implement 1.1 specific features.
- RFC 9110 - Provides a more recent covering of all HTTP semantics, and as such obsoletes a whole lot of older RFCs, including the 72XX ones. Think of it as the glossary of HTTP.
- RFC 3875 - The Common Gateway Interface specification.
- RFC 6265 - The RFC describing cookies.
- A Simple HTTP Server from Scratch - Example of a basic web server using sockets and c++ 98
- Exploring nginx's structure - Chapter of a book about open source applications -- Useful to understand of nginx works inside
- MDN Guides and Resources on HTTP - Great index of resources to learn how HTTP works (paraphrases the RFCs in more readable ways)
AI (as in Large Language Models or LLMs) were used in both the design and implementation parts of this project. Its main utility was understanding concepts, and figuring out issues. Little to no actual code was written by an LLM, save for targeted refactors, such as moving/renaming functions, or changing a way a specific function was called after a signature change. LLMs were also used in the testing stage, in order to find still standing issues we hadn't found by ourselves. Issues found included chunked encoding and HTTP redirections issues.