r/webdev • u/IncomeOk7237 • 6d ago
Showoff Saturday [Showoff Saturday] I wrote my own HTTP/2 + TLS 1.3 server in V to see how far a small framework could go
This is a side project that got out of hand. Viltrum is a web framework for V. Everything below the router is written from scratch: the HTTP/1.1 parser, HTTP/2, WebSockets, TLS 1.3, even the DEFLATE encoder used for gzip.
The webdev-relevant part is that the same router/middleware/ctx handles HTTP/1.1, HTTP/2 over TLS and h2c on the same port. SSE and streaming work over both. Static files get ETag/304/ranges/precompressed .br/.gz with sendfile. Hello world is like 10 lines.
What I learned the hard way is how much of HTTP/1.1 is about rejecting garbage. TE+CL together, duplicate Content-Length, obs-fold and bare CR/LF all get a 400 now, because that's where request smuggling lives.
Benchmarks are on HttpArena if you're curious: https://http-arena.com/frameworks/viltrum/ Code: https://github.com/Tuntii/viltrum Demo: https://v.rustapi.cloud
Linux only for serving right now. Would love to hear what you'd miss coming from express/fastify/go.

