Skip to content

This project is about developing a tiny HTTP server that responds to client requests.

Notifications You must be signed in to change notification settings

Abdellahmaarifa-1337/webServer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webserv: This is when you finally understand why a URL starts with HTTP

I. Introduction

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.

II. General Rules

  • 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.

III. Mandatory Part

III.1 Requirements

  • 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).

III.2 For MacOS Only

  • MacOS-specific instructions for using fcntl().

III.3 Configuration File

  • 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.

IV. Bonus Part

  • Support cookies and session management.
  • Handle multiple CGI.

V. What I Learned

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.

About

This project is about developing a tiny HTTP server that responds to client requests.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 90.3%
  • PHP 4.6%
  • HTML 1.9%
  • Makefile 1.7%
  • Other 1.5%