Skip to content

maxBRT/httpfromtcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DsqKWVgXQAE5axK-1

HTTP from TCP

This project is a minimal HTTP/1.1 implementation in Go, built directly on top of the TCP socket API, following the RFC 9112 specification.

It’s intentionally barebones, written to explore the inner workings of HTTP from the ground up. Building it was an eye-opening experience that I’d recommend to any developer curious about how the web actually works beneath the abstractions.

🧠 Goals

  • Understand how HTTP/1.1 operates at the transport layer
  • Implement requests, responses, and headers manually
  • Explore chunked transfer encoding and content delivery
  • Reinforce networking fundamentals in Go

🚀 Usage

Clone the repository:

git clone https://github.com/maxBRT/httpfromtcp

Run the server:

go run cmd/httpserver.go

🧪 Testing the Server

Basic requests

Use curl to test basic responses:

curl -v http://localhost:42069/anything
curl -v http://localhost:42069/yourproblem
curl -v http://localhost:42069/myproblem

Chunked encoding

curl -v http://localhost:42069/httpbin/stream/100

Binary response

Open this one directly in your browser:

http://localhost:42069/video

⚙️ Notes

  • The server uses manual TCP handling instead of net/http.
  • Error handlers return simple HTML pages for 400, 500, and success responses.
  • Ideal for learning, debugging, or experimenting with HTTP at a low level.

🙏 Acknowledgements

This project was developed as part of the Boot.dev HTTP protocol paid course by The Primeagen. The course guided the implementation and provided the foundational concepts behind this server.

About

Reimplementation of an HTTP server from scratch

Resources

Stars

Watchers

Forks

Languages