This project involves writing a custom HTTP server in C++ 98, providing hands-on experience with the intricacies of the Hypertext Transfer Protocol (HTTP). The server must be capable of serving web pages, handling various HTTP methods, and implementing features essential for a functional web server.
- The program must be non-blocking and handle potential issues gracefully without unexpected crashes.
- A Makefile must be provided with the necessary rules for compilation.
- Compile code using
c++
with flags-Wall -Wextra -Werror
and comply with C++ 98 standards. - Avoid external libraries and Boost libraries.
- The program must take a configuration file as an argument or use a default path.
- It must never block, and clients should be handled properly even if bouncing is necessary.
- Use only 1
poll()
(or equivalent) for all I/O operations. - Implement GET, POST, and DELETE methods.
- Serve a fully static website.
- Clients should be able to upload files.
- Perform stress tests to ensure server availability.
- Listen to multiple ports (see Configuration file).
- MacOS-specific instructions for using
fcntl()
.
- Configure ports, hosts, server names, error pages, client body size limits, and routes.
- Define accepted HTTP methods, redirections, directories/files, directory listing, default files, and CGI execution.
- Support cookies and session management.
- Handle multiple CGI.
Throughout this project, I gained valuable knowledge and skills in the following areas:
-
HTTP Protocol: Deepened understanding of the HTTP protocol, its structure, and its role in web communication.
-
C++ Development: Enhanced C++ programming skills, adhering to standards and implementing non-blocking server features.
-
Configuration Management: Implemented a configuration file parser for flexible server customization.
-
Web Server Functionality: Developed a fully functional web server capable of serving static content, handling various HTTP methods, and interacting with CGI.
-
Testing and Debugging: Learned effective testing strategies and debugging techniques to ensure the server's resilience and reliability.
-
Server Security: Explored security considerations, such as client body size limits and error handling, to enhance server robustness.
-
Bonus Features: Implemented additional features like session management and multiple CGI handling to enhance the server's capabilities.
This project significantly expanded my understanding of web server development, HTTP protocols, and C++ programming, providing a solid foundation for future projects in system administration and networking.