Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

C++23 Asynchronous High-Performance HTTP/1.1 Web Server

An asynchronous, high-performance HTTP/1.1 web server implemented in C++23 for Windows platforms using Windows I/O Completion Ports (IOCP) and WinSock2. The project features custom data structures (Stack, Queue), a custom HTTP request parser, zero-copy file transmission, and an integrated Breadth-First Search (BFS) maze solver accessible via custom HTTP headers.


📸 Key Features

  • High-Performance Asynchronous I/O: Powered by Windows IOCP and advanced WinSock API extensions (AcceptEx, TransmitFile) for concurrent socket handling and zero-copy file serving.
  • Multi-Threaded Architecture: Scalable worker thread pool leveraging std::jthread and lock-free thread allocation based on hardware concurrency (std::thread::hardware_concurrency).
  • HTTP/1.1 Request Parsing: Hand-crafted state-machine parser utilizing std::string_view for efficient tokenization without dynamic allocations.
  • Integrated BFS Maze Solver: Built-in maze solving pathfinder executed via custom Maze HTTP headers and request bodies using a custom Queue implementation.
  • Modern C++23 Design: Utilizes std::expected, custom container implementations, filesystem utilities, and strict compiler flag checks across GCC, Clang, and MSVC.

🏗️ Architecture & Data Structures

Structure / Module Source File Description
HttpServer & ThreadPool server.cpp Core server engine initializing socket listeners, IOCP queues, and managing high-throughput worker threads executing AcceptEx and TransmitFile.
HTTPparser server.cpp State-machine based parser supporting HTTP methods (GET, POST, DELETE), custom header extraction, and path validation preventing path-traversal attacks (..).
Maze & Queue / Stack server.cpp Generic deque-backed container classes (Queue<T>, Stack<T>) using std::expected for error handling, driving a BFS grid-traversal maze-solving algorithm.

🚀 Building & Running

Prerequisites

  • OS: Windows (requires Windows Sockets 2 & IOCP support via ws2_32 and mswsock).
  • Compiler: Modern C++ compiler supporting C++23 (MSVC 2022+, GCC 13+, or Clang 16+).
  • Build System: CMake version 3.15 or higher.
  • Dependencies: Internet connection on initial CMake configure step to fetch {fmt} (v10.2.1).

Build Steps

  1. Clone the repository:

    git clone [git@github.com:Sebo1411/HTTP-Server-MazeSolver.git](git@github.com:Sebo1411/HTTP-Server-MazeSolver.git)
    cd HTTP-Server-MazeSolver
    
  2. Configure with CMake:

    mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release

  3. Compile:

    cmake --build .

  4. Run the Server:

    Run from current executable directory

    ./server.exe

    Or specify custom root directory for serving static files

    ./server.exe -l C:\path\to\webroot

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages