How palliplease/http-server-in-c-plus-plus works
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 Server loop · index.html Index page · about.html About page · 404.html 404 page
Components 10
Network lifecycle
- Server loop
main.cpp - Winsock API
Request handling
- Request parsing
main.cpp - Path routing
main.cpp - Response sending
main.cpp
Static content
- File lookup
main.cpp - Index page
index.html - About page
about.html - 404 page
404.html
Other components
- Browser client
Connections 16
- 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