{"id":18337781,"url":"https://github.com/pin3dev/42_webserv","last_synced_at":"2026-05-16T13:04:45.763Z","repository":{"id":252129306,"uuid":"794134996","full_name":"pin3dev/42_Webserv","owner":"pin3dev","description":"A simple HTTP/1.1 server written in C++, supporting GET, POST, DELETE methods, virtual hosting, CGI script execution, and custom error pages. Ideal for understanding the basic concepts of web servers.","archived":false,"fork":false,"pushed_at":"2024-08-14T11:53:17.000Z","size":52932,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-13T22:26:47.824Z","etag":null,"topics":["42-webserv","42born2code","42projects","42school","cgi-application","cgi-script","html-css-javascript","multiplexing-circuits","polling","socket-io","webserver","website"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pin3dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-30T14:17:46.000Z","updated_at":"2025-07-01T15:40:29.000Z","dependencies_parsed_at":"2024-08-14T13:09:31.725Z","dependency_job_id":null,"html_url":"https://github.com/pin3dev/42_Webserv","commit_stats":null,"previous_names":["pin3dev/42_webserv"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pin3dev/42_Webserv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_Webserv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_Webserv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_Webserv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_Webserv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pin3dev","download_url":"https://codeload.github.com/pin3dev/42_Webserv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pin3dev%2F42_Webserv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33103971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42-webserv","42born2code","42projects","42school","cgi-application","cgi-script","html-css-javascript","multiplexing-circuits","polling","socket-io","webserver","website"],"created_at":"2024-11-05T20:12:15.634Z","updated_at":"2026-05-16T13:04:45.758Z","avatar_url":"https://github.com/pin3dev.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--# Webserv `110/125`\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/pin3dev/42_Cursus/blob/192db266f898636eefa274ed3be4aa8cc11b1397/assets/Webserv/Rdm/webserv_demo.gif\" width=\"600\" height=\"375\" /\u003e\n\u003c/p\u003e\n\n## Table of Contents  \n- [Project Overview](#overview)  \n- [Mandatory Features](#features)  \n- [Project Compilation and Execution](#compilation-and-execution)  \n- [Tests -  Usage Examples](#usage-examples)  \n- [Contributors and License](#contributors)  \n\n\n## Overview  \n\nThe `Webserv` project is designed to handle HTTP requests and responses, implementing basic functionalities of a web server \nsuch as parsing HTTP requests, managing server configurations, handling connections, and serving static files or CGI scripts.  \n\n## Features  \n1. HTTP/1.1 compliant\n2. Support for GET, POST, and DELETE methods\n3. Custom configuration file support\n4. Virtual hosting\n5. Autoindexing  \n6. Error handling and custom error pages  \n7. CGI script execution\n \n## Compilation and Execution\nTo compile the project, clone the repository and use the provided Makefile.  \n\n```bash\ngit clone https://github.com/pin3dev/42_Webserv.git   \ncd 42_Webserv  \nmake\n```\n\n## Usage Examples\nIf no configuration file is specified, the server will use the default configuration located at configs/default.conf.\n```bash\n./webserv [configuration file]\n```\n\n### Configuration\nThe configuration file allows you to set up the server and define its behavior. Below is an example of a basic configuration:\n\n```bash\n\nserver {\n\tserver_name www.site1;\n\tlisten 8080;\n\thost localhost;\n\troot www/site1;\n\tindex index.html;\n\tclient_max_body_size 2M;\n\terror_page 404.html;\n\n\tlocation / {\n\t\tallow_methods GET;\n\t\t#try_file tutorial.html;\n\t}\n\n\tlocation /upload {\n\t\tallow_methods GET DELETE;\n\t}\n\n\tlocation .py {\n\t\tallow_methods GET POST;\n\t\tcgi_path /cgi;\n\t\tcgi_ext .py;\n\t\tupload_to /upload;\n\t}\n\n\tlocation /favicon.ico {\n\t\tallow_methods GET;\n\t}\n\n\tlocation /assets {\n\t\tallow_methods GET;\n\t\tautoindex on;\n\t}\n\n\tlocation /redirect {\n\t\tallow_methods GET;\n\t\treturn /;\n\t}\n}\n```\n#### Configuration Directives\n- listen: The port on which the server will listen.\n- server_name: The server's domain name.\n- root: The root directory for the server.\n- index: The default index file.\n- error_page: Custom error pages.\n- location: Define specific behavior for certain URL patterns.\n- autoindex: Enable directory listing.\n- cgi_path: Path to the CGI executable.\n- cgi_ext: File extension for CGI scripts.\n- allow_methods: HTTP methods allowed for the location.\n- upload_to: Directory for file uploads.\n  \n### Code Structure\n`Makefile`: Instructions for compiling the project.  \n`exe/`: Source files for the main server functionality.  \n`inc/`: Header files.  \n`configs/`: Example configuration files.  \n\n### Testing\nThere is a tutorial page in HTML `www/site1/tutorial.html` that helps with testing the server using `curl` and directly in the browser. \nThis page provides examples and instructions on how to perform various HTTP requests and view the results.  \n\nTo access the tutorial page:\n\n1. Ensure the server is running.\n2. Open a web browser and navigate to `http://localhost/tutorial.html`\n3. This page will guide you through testing different endpoints and methods supported by the server.\n\n## Contributors\n\n* Ívany Pinheiro aka [`@pin3dev`](https://github.com/pin3dev)  \n* Clara Franco aka [`@clima-fr`](https://github.com/clima-fr)  \nFeel free to submit issues or pull requests if you have suggestions or improvements.\n\n## License\nThis project is open-source and available under the MIT License.\n\n\n---\n\n\n--\u003e\n\n\u003ch1 align=\"center\"\u003eWebserv\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e \n  \u003cimg src=\"https://img.shields.io/badge/grade-110%2F125-green?style=for-the-badge\u0026logo=42\u0026labelColor=gray\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e \n  \u003ca href=\"https://github.com/pin3dev/42_Cursus/tree/main/library/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/HTTP/1.1-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/CGI_script-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Socket-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Multiplexing-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/ConfigParser-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Autoindexing-blue?style=for-the-badge\"/\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Virtual_Hosting-blue?style=for-the-badge\"/\u003e\n\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/pin3dev/42_Cursus/blob/192db266f898636eefa274ed3be4aa8cc11b1397/assets/Webserv/Rdm/webserv_demo.gif\" width=\"600\" height=\"375\" /\u003e\n\u003c/p\u003e\n\n\u003ch3\u003e\n  \u003cp align=\"center\"\u003e \n    \u003ca href=\"#introduction\"\u003eIntroduction\u003c/a\u003e • \n    \u003ca href=\"#structure\"\u003eStructure\u003c/a\u003e • \n    \u003ca href=\"#docs\"\u003eDocs\u003c/a\u003e • \n    \u003ca href=\"#cloning\"\u003eCloning\u003c/a\u003e • \n    \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e • \n    \u003ca href=\"#norms\"\u003eNorms\u003c/a\u003e • \n    \u003ca href=\"#theoretical\"\u003eTheoretical\u003c/a\u003e   \n\t\u003ca href=\"#contributors\"\u003eContributors\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/h3\u003e\n\n## 🗣️ Introduction \u003ca id=\"introduction\"\u003e\u003c/a\u003e\n\n**Webserv** is a lightweight HTTP/1.1 web server built from scratch in C++. It is capable of serving static files, executing CGI scripts, handling custom routes, virtual hosts, and more.\n\nThis project aims to deepen understanding of how web servers work under the hood, while applying knowledge of sockets, HTTP protocol, file I/O, and configuration parsing.\n\n## 🧬 Project Structure \u003ca id=\"structure\"\u003e\u003c/a\u003e\n\nThe project is organized as follows:\n\n* `exe/`: Core source files of the server\n* `inc/`: Header files\n* `configs/`: Example configuration files\n* `www/`: Static web content and HTML tutorials\n\nA `Makefile` is provided to facilitate compilation.\n\n## 🗃️ Documentation \u003ca id=\"docs\"\u003e\u003c/a\u003e\n\nFor a detailed breakdown of how the project works, please visit the documentation link below:\n\n\u003cp align=\"center\"\u003e \n  \u003ca href=\"https://github.com/pin3dev/42_Cursus/wiki/Webserv\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Webserv_Docs-lightgreen?style=for-the-badge\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n## 🫥 Cloning the Repository \u003ca id=\"cloning\"\u003e\u003c/a\u003e\n\nTo clone this repository and compile the project, run the following commands:\n\n```bash\ngit clone https://github.com/pin3dev/42_Webserv.git\ncd 42_Webserv\n```\nThis will download the project to your local machine. Once inside the `webserv` directory, run the provided `Makefile` to compile the project.\n\n## 🕹️ Compilation and Usage \u003ca id=\"usage\"\u003e\u003c/a\u003e\n\n### Makefile\n\nThe `Makefile` includes the following rules:\n\n* `make`: Builds the `webserv` executable\n* `make clean`: Removes object files\n* `make fclean`: Removes object files and binary\n* `make re`: Rebuilds everything from scratch\n\nTo compile the project, run:\n```bash\nmake\n```\nThis will generate the executable `webserv`, which can then be launched with a configuration file.\n\n### Basic Usage\n\n1. Start the server:\n```bash\n./webserv [config_file]\n```\n\u003e If no config file is specified, it defaults to `configs/default.conf`.\n\n### Configuration\nThe configuration file allows you to set up the server and define its behavior. Below is an example of a basic configuration:\n\n```bash\nserver {\n\tserver_name www.site1;\n\tlisten 8080;\n\thost localhost;\n\troot www/site1;\n\tindex index.html;\n\tclient_max_body_size 2M;\n\terror_page 404.html;\n\n\tlocation / {\n\t\tallow_methods GET;\n\t\t#try_file tutorial.html;\n\t}\n\n\tlocation /upload {\n\t\tallow_methods GET DELETE;\n\t}\n\n\tlocation .py {\n\t\tallow_methods GET POST;\n\t\tcgi_path /cgi;\n\t\tcgi_ext .py;\n\t\tupload_to /upload;\n\t}\n\n\tlocation /favicon.ico {\n\t\tallow_methods GET;\n\t}\n\n\tlocation /assets {\n\t\tallow_methods GET;\n\t\tautoindex on;\n\t}\n\n\tlocation /redirect {\n\t\tallow_methods GET;\n\t\treturn /;\n\t}\n}\n```\n\n* `listen`: Port the server listens on\n* `server_name`: Virtual host domain\n* `root`: Document root for serving files\n* `index`: Default file to serve\n* `error_page`: Custom error page\n* `location`: Define specific behavior for URI paths\n* `autoindex`: Enable directory listing\n* `cgi_path` / `cgi_ext`: CGI execution path and file extension\n* `allow_methods`: Accepted HTTP methods (GET, POST, DELETE)\n* `upload_to`: File upload destination directory\n\n### 🧪 Testing the Server\n\nA tutorial page is available at:\n\n```bash\nhttp://localhost:\u003cport\u003e/tutorial.html\n```\n\nThis page provides step-by-step instructions for testing routes using `curl`, HTTP clients, or your browser. It includes examples for different methods like GET, POST, and DELETE.\n\n\n## ⚠️ Norms and Guidelines Disclaimer \u003ca id=\"norms\"\u003e\u003c/a\u003e\n\nThis project strictly follows the [42 Norm](https://github.com/pin3dev/42_Cursus/blob/b9cd0fe844ddb441d0b3efb98abcee92aee49535/assets/General/norme.en.pdf). Some design decisions may seem unusual but are required to comply with school coding standards.\n\n\n## 📖 Theoretical Background \u003ca id=\"theoretical\"\u003e\u003c/a\u003e\n\nAll supporting material and theory used for this project are documented and available here:\n\n\u003cp align=\"center\"\u003e \n  \u003ca href=\"https://github.com/pin3dev/42_Cursus/tree/main/library/#05-Webserv\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Webserv_Theory-gray?style=for-the-badge\"/\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## 👥 Contributors \u003ca id=\"contributors\"\u003e\u003c/a\u003e\n\n\u003ca href=\"https://github.com/pin3dev\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Ivany_Pinheiro-%40pin3dev-purple?style=for-the-badge\"/\u003e  \n\u003c/a\u003e  \n\u003cbr\u003e\n\u003ca href=\"https://github.com/clima-fr\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Clara_Franco-%40clima--fr-purple?style=for-the-badge\"/\u003e  \n\u003c/a\u003e\n\nFeel free to open issues or contribute improvements via pull requests!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpin3dev%2F42_webserv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpin3dev%2F42_webserv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpin3dev%2F42_webserv/lists"}