# palliplease/http-server-in-c-plus-plus architecture

> Architecture diagram of the GitHub repository palliplease/http-server-in-c-plus-plus, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/palliplease/http-server-in-c-plus-plus
- Repository: https://github.com/palliplease/http-server-in-c-plus-plus

## Overview

This is a small, single-file Windows HTTP/1.1 server. A browser connects to the server, which accepts a client socket, reads and parses one request line, maps the path to an HTML file, and sends either that file or the 404 page in an HTTP response. The README also documents port 8080 and static HTML routing. Runtime stages are inline in main.cpp rather than separate modules; the graph separates them conceptually. The HTML file reads and response behavior are visible in the sampled source.

Main entry points: [`main.cpp`](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp) (Server loop), [`index.html`](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/index.html) (Index page), [`about.html`](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/about.html) (About page), [`404.html`](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/404.html) (404 page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Network lifecycle"]
  node_server["Server loop<br/>[main.cpp]"]
  node_winsock["Winsock API"]
end

subgraph group_handling["Request handling"]
  node_request["Request parsing<br/>[main.cpp]"]
  node_routing["Path routing<br/>[main.cpp]"]
  node_response["Response sending<br/>[main.cpp]"]
end

subgraph group_content["Static content"]
  node_filelookup["File lookup<br/>[main.cpp]"]
  node_index["Index page<br/>[index.html]"]
  node_about["About page<br/>[about.html]"]
  node_notfound["404 page<br/>[404.html]"]
end

node_browser(("Browser client"))

node_browser -->|"connects"| node_server
node_server -->|"initializes socket"| node_winsock
node_server -->|"binds and listens"| node_winsock
node_server -->|"accepts client"| node_winsock
node_browser -->|"sends request"| node_winsock
node_winsock -->|"delivers request"| node_server
node_server -->|"parses request"| node_request
node_request -->|"provides path"| node_routing
node_routing -->|"selects file"| node_filelookup
node_filelookup -->|"reads root"| node_index
node_filelookup -->|"reads routed page"| node_about
node_filelookup -->|"reads fallback"| node_notfound
node_filelookup -->|"provides body"| node_response
node_server -->|"sends response"| node_response
node_response -->|"writes response"| node_winsock
node_winsock -->|"returns response"| node_browser

click node_server "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp"
click node_request "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp"
click node_routing "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp"
click node_filelookup "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp"
click node_response "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp"
click node_index "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/index.html"
click node_about "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/about.html"
click node_notfound "https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/404.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_server,node_winsock,node_browser toneBlue
class node_request,node_routing,node_response toneAmber
class node_filelookup,node_index,node_about,node_notfound toneMint
```

## Components

### Network lifecycle

- [Server loop](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp): `main.cpp`
- **Winsock API**

### Request handling

- [Request parsing](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp): `main.cpp`
- [Path routing](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp): `main.cpp`
- [Response sending](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp): `main.cpp`

### Static content

- [File lookup](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/main.cpp): `main.cpp`
- [Index page](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/index.html): `index.html`
- [About page](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/about.html): `about.html`
- [404 page](https://github.com/palliplease/http-server-in-c-plus-plus/blob/main/404.html): `404.html`

### Other components

- **Browser client**

## Connections

- Browser client → Server loop: connects
- Server loop → Winsock API: initializes socket
- Server loop → Winsock API: binds and listens
- Server loop → Winsock API: accepts client
- Browser client → Winsock API: sends request
- Winsock API → Server loop: delivers request
- Server loop → Request parsing: parses request
- Request parsing → Path routing: provides path
- Path routing → File lookup: selects file
- File lookup → Index page: reads root
- File lookup → About page: reads routed page
- File lookup → 404 page: reads fallback
- File lookup → Response sending: provides body
- Server loop → Response sending: sends response
- Response sending → Winsock API: writes response
- Winsock API → Browser client: returns response
