A minimal HTTP/1.1 server built from scratch in Go without using the net/http package.
The project demonstrates how HTTP works over raw TCP connections by manually handling request parsing and response generation.
- TCP server using Go’s
netpackage - Manual HTTP request parsing
- Header handling with
Content-Lengthsupport - Structured request and response models
- Valid HTTP/1.1 response generation
- Method-based routing (
GET /,GET /hello)
TCP Connection → Request Parsing → Router → Handler → Response Writing
/cmd/server → entry point
/internal/http → request, response, parser, writer
/internal/server → connection handling
/internal/handler → router and handlers
/internal/transport → connection utilities
go run cmd/server/main.goServer runs on:
localhost:4221
curl http://localhost:4221/Response:
HTTP/1.1 200 OK
Content-Length: 11
Connection: close
Hello World
Notes
- Built for learning and understanding HTTP internals
- Does not support keep-alive, HTTP/2, or advanced routing