This project involves creating an HTTP server in C++ 98 that complies with HTTP 1.1 standards. The server is capable of handling multiple CGI scripts, serving static websites, managing file uploads, and processing GET, POST, and DELETE requests. The project is developed with portability and robustness in mind, ensuring compatibility across different environments.
- HTTP 1.1 Compliant: The server adheres to the HTTP 1.1 standard, ensuring proper communication with modern web browsers.
- Non-Blocking I/O: Uses
select()
for handling I/O operations, ensuring the server remains responsive. - Multiple CGI Support: Handles multiple CGI scripts, enabling dynamic content generation.
- Static File Serving: Capable of serving static HTML, CSS, JavaScript, and image files.
- File Uploads: Supports file uploads via POST requests.
- Configuration File: Uses a configuration file for setting server parameters like port, host, and routes.
- Error Handling: Provides default error pages and accurate HTTP response status codes.
- Multi-Port Listening: Can listen on multiple ports as specified in the configuration file.
- Stress Tested: Ensures resilience and availability under high traffic conditions.
- A Unix-like operating system (Linux, macOS, etc.).
- C++ compiler supporting C++ 98 standard.
- Make utility.
-
Clone the repository:
git clone https://github.com/speranos/WebServ.git cd WebServ
-
Build the project using the Makefile:
make
To run the server, use the following command:
./webserv webserv.conf
The configuration file allows you to specify various server settings. Here is an example of configuration file:
server {
listen 8080;
server_name localhost;
location / {
root www;
index index.html;
}
location /uploads {
root www/uploads;
client_max_body_size 10M;
}
error_page 404 /404.html;
cgi /cgi-bin {
extension .cgi;
}
}
The project also includes support for handling multiple CGI scripts, enhancing its capability to serve dynamic content.
This web server project is a robust implementation of an HTTP server in C++ 98, capable of handling both static and dynamic content. The provided configuration file allows for flexible server setups, and the server's non-blocking I/O ensures it remains responsive under high load.