Webserv is a custom HTTP server implementation in C++ 98, designed to provide a deep understanding of web server functionality and HTTP protocol intricacies.
This project involves creating a fully functional web server that can:
- Handle HTTP requests
- Serve static websites
- Support multiple server configurations
- Implement non-blocking I/O operations
- Handle CGI (Common Gateway Interface) scripts
- Supports HTTP 1.1 protocol
- Non-blocking server architecture
- Configurable through a dedicated configuration file
- Supports multiple ports and server configurations
- Implements GET, POST, and DELETE HTTP methods
- CGI script execution
- File upload capabilities
- Custom error page handling
- C++ 98 compiler
- No external libraries (except standard C++ libraries)
- Operating System: Linux, macOS, or Windows with Docker
git clone https://github.com/aabderrafie/webserve_42.git
cd webserve_42
make- Ensure Docker is installed and running
- Build the project:
make dockerThe server is configured using a configuration file similar to NGINX. You can specify:
- Server ports and hosts
- Server names
- Default error pages
- Client body size limit
- Route configurations
- Accepted HTTP methods
- URL redirects
- File and directory serving
- Directory listing
- CGI script execution
- File upload handling
./webserv [configuration_file]If no configuration file is provided, a default configuration will be used.
- Use telnet for basic HTTP testing
- Compare behavior with NGINX
- Implement stress tests to ensure server resilience
The server supports at least one CGI implementation:
- PHP-CGI
- Python
- Other CGI-compatible scripting languages
- Cookies and session management
- Multiple CGI support
- Follows C++ 98 standard
- Uses non-blocking I/O with poll() (or equivalent)
- Handles client disconnections gracefully
- Supports multiple simultaneous client connections
- Does not implement the entire HTTP RFC
- Designed for educational purposes
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a pull request
- 42 Network
- HTTP RFC specifications
- NGINX documentation