A minimal yet functional HTTP/1.1 server implemented from scratch in Go, using only the standard net package.
This project was built to understand the internals of HTTP and TCP, following RFC 9110 (HTTP Semantics) and RFC 9112 (HTTP/1.1).
- π Built using raw TCP sockets
- βοΈ Compliant with HTTP/1.1 semantics
- π§΅ Concurrent client handling using goroutines
- π¦ Chunked Transfer Encoding support (streamed responses)
- πΌοΈ Binary data support β serves images, videos, etc.
- π Request parsing and response generation from scratch
The goal of this project was to:
- Deeply understand how HTTP actually works under the hood
- Explore Goβs low-level networking capabilities (
netpackage) - Learn how HTTP messages are parsed, formatted, and transmitted over TCP
- The server listens on a TCP port (default
:42069) - Accepts incoming TCP connections
- Spawns a goroutine per client connection
- Parses:
- Request line (
GET /index.html HTTP/1.1) - Headers
- Optional body
- Request line (
- Sends a valid HTTP/1.1 response, using:
Content-Length(for known sizes)- or
Transfer-Encoding: chunked(for streaming)
- Supports binary and text responses
- Closes the connection
Dibakar Ghosh π GitHub Profile