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.
- 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::jthreadand 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_viewfor efficient tokenization without dynamic allocations. - Integrated BFS Maze Solver: Built-in maze solving pathfinder executed via custom
MazeHTTP headers and request bodies using a customQueueimplementation. - Modern C++23 Design: Utilizes
std::expected, custom container implementations, filesystem utilities, and strict compiler flag checks across GCC, Clang, and MSVC.
| 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. |
- OS: Windows (requires Windows Sockets 2 & IOCP support via
ws2_32andmswsock). - 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).
-
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 -
Configure with CMake:
mkdir build cd build cmake .. -DCMAKE_BUILD_TYPE=Release
-
Compile:
cmake --build .
-
Run the Server:
./server.exe
./server.exe -l C:\path\to\webroot