{"id":22406663,"url":"https://github.com/mvpee/42-webserv","last_synced_at":"2025-07-31T19:31:19.318Z","repository":{"id":254851323,"uuid":"847732867","full_name":"MVPee/42-webserv","owner":"MVPee","description":"A non-blocking HTTP/1.1 server written in C++, designed to handle multiple simultaneous connections efficiently using asynchronous I/O.","archived":false,"fork":false,"pushed_at":"2024-10-24T19:01:50.000Z","size":2519,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-26T05:14:48.934Z","etag":null,"topics":["19","42","accept","bind","cpp","http","request","response","socket","webserv"],"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/MVPee.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-08-26T12:49:23.000Z","updated_at":"2024-10-24T19:01:53.000Z","dependencies_parsed_at":"2024-10-24T23:27:27.722Z","dependency_job_id":"25afc614-c5b1-4bc1-be09-038eaf32c99c","html_url":"https://github.com/MVPee/42-webserv","commit_stats":null,"previous_names":["mvpee/42-webserv"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MVPee%2F42-webserv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MVPee%2F42-webserv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MVPee%2F42-webserv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MVPee%2F42-webserv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MVPee","download_url":"https://codeload.github.com/MVPee/42-webserv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228283565,"owners_count":17896266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["19","42","accept","bind","cpp","http","request","response","socket","webserv"],"created_at":"2024-12-05T11:09:29.207Z","updated_at":"2024-12-05T11:09:29.936Z","avatar_url":"https://github.com/MVPee.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\t📖 42-Webserv\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cimg alt=\"GitHub code size in bytes\" src=\"https://img.shields.io/github/languages/code-size/MVPee/42-webserv?color=lightblue\" /\u003e\n\t\u003cimg alt=\"Code language count\" src=\"https://img.shields.io/github/languages/count/MVPee/42-webserv?color=yellow\" /\u003e\n\t\u003cimg alt=\"GitHub top language\" src=\"https://img.shields.io/github/languages/top/MVPee/42-webserv?color=blue\" /\u003e\n\t\u003cimg alt=\"GitHub last commit\" src=\"https://img.shields.io/github/last-commit/MVPee/42-webserv?color=green\" /\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n\t\u003ca href=\"#-about-the-project\"\u003eAbout\u003c/a\u003e\n\t\u003cspan\u003e · \u003c/span\u003e\n\t\u003ca href=\"#-running-the-server\"\u003eRunning\u003c/a\u003e\n\t\u003cspan\u003e · \u003c/span\u003e\n\t\u003ca href=\"#-configurating-the-server\"\u003eConfiguration\u003c/a\u003e\n\t\u003cspan\u003e · \u003c/span\u003e\n\t\u003ca href=\"#-key-features\"\u003eKey features\u003c/a\u003e\n\u003c/h3\u003e\n\n\n# 💡 About the project\n\u003eThis is when you finally understand why a URL starts\nwith HTTP.\n\nThis project is about writing a non-blocking HTTP/1.1 server in C++, designed to handle multiple simultaneous connections efficiently using asynchronous I/O. The server adheres to the HTTP/1.1 protocol and supports essential features such as GET, POST, DELETE, and error handling, ensuring responsive communication without stalling the main execution thread. Additionally, the server integrates non-blocking CGI execution, supporting various languages such as Python, Perl, PHP, and binary executables. Multi threading implementation, each server instance runs on its own thread.\n\n![gallery](./.imgs/gallery.png)\n\n## 🚀 Running the server \n\n```bash\nmake run\n```\nIt will automatically compile the project and run it.\n```bash\n./webserv [configuration file]\n```\nWill launch the previously compiled project with `make` and run it. (configuration file must be a valid `.conf` file see section below)\n\n![Servers](./.imgs/Servers.png)\n\n## 💻 Configurating the server\n\n\u003c/br\u003eIt will allow you to setup the following parameters :\n- `name` -- define the server name\n- `listen`:`port` -- to configure on which port the server will be listening (only one `listen` per `server` block)\n- `methods` -- to set the authorized HTTP request (`GET` | `POST` | `DELETE`)\n- `location` -- to set parameters for a specific route\n- `index` -- to serve a default file if none match the requested URI\n- `root` -- to route the requested URI to another directory\n- `upload` -- to set a specific directory for upload requests\n- `listing` -- to list all files present in the targeted directory (`ON` | `OFF`)\n- `error` -- to define the page to display when an error occurs, add a default page if none is provided in the `.conf` file.\n- `cgi` -- to configure a cgi to execute for a specific file extenstion (`.php` | `.py` | `.pl`)\n- `redirection` -- to define a redirection to a location or to an another server\n```\n{\n    name server\n    listen 0.0.0.0:8080\n    methods GET POST\n    body_size 1000000000000\n    root ./rsrcs\n    upload /upload\n    index index.html\n    error 404 404.html\n    location /cookie\n        root ./rsrcs/cookie\n        index cookie.html\n        methods GET\n    location /cgi\n        root ./rsrcs/cgi\n        listing ON\n        cgi .py .php\n        methods GET POST\n    location /intra\n        root ./rsrcs/intra\n        index intra.html\n        methods GET\n    location /listing\n        listing ON\n        error 403 403.html\n        error 404 404.html\n        root ./rsrcs/listing\n        methods GET\n    location /listing/403.html\n        root ./rsrcs/listing/403.html\n    location /listing/404.html\n        root ./rsrcs/listing/404.html\n    location /listing/1/2/3\n        redirection /listing\n    location /upload\n        root ./rsrcs/upload\n        methods GET DELETE\n    location /redirection\n        redirection https://fr.wikipedia.org/\n}\n```\n------------\n## 📜 Key Features\n\n- **Configuration Flexibility**  \n  -- Accepts a custom configuration file or defaults to a predefined path\n\n- **Non-Blocking Architecture**  \n  -- Uses a single `select()` (or equivalent) per server for all I/O operations, including listening and client communication\n\n- **Efficient Resource Management**  \n  -- Handles all read/write operations via `select()`, optimizing resource usage and **preventing blocking**\n\n- **HTTP Methods**  \n  -- Supports `GET`, `POST`, and `DELETE`\n\n- **File Uploads**  \n  -- Allows clients to upload files directly to the server\n\n- **Static File Serving**  \n  -- Serves static websites\n\n- **Accurate HTTP Responses**  \n  -- Delivers precise status codes along with a specified error page or a default one\n\n- **CGI Integration**  \n  -- Supports CGI execution (e.g., `PHP`, `Python`, `Perl`, ...)\n\n- **Multi-Port Listening**  \n  -- Listens on multiple ports as defined in the configuration file\n\n- **Browser Compatibility**  \n  -- Compliant with HTTP 1.1 standards.\n\n- **Handle Cookies**  \n  -- A small cookie clicker has been made to show the implementation of the cookies\n\n- **Keep-alive connection**  \n  -- Connection is kept alive if possible\n\n- **Time out**  \n  -- Timeout for CGI and basic requests\n\n---\n\n![Cookie-clicker](./.imgs/Cookie-clicker.png)\n\n---\nThis group project was done by [MVPee (mvan-pee)](https://github.com/MVPee) and [Dan (dspilleb)](https://github.com/dspilleb)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvpee%2F42-webserv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmvpee%2F42-webserv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmvpee%2F42-webserv/lists"}