3 ms·
Http/1.1 is dead simple if you ignore most of the spec. If you only take get requests and set content-length on response you will be good for 99% of user agents
by ironhaven 2y ago
Http/1.1 is dead simple if you ignore most of the spec. If you only take get requests and set content-length on response you will be good for 99% of user agents. It’s not much more code to handle the transfer-encoding and byte-range headers. HTTPS is just http over a tls socket which is the level of abstraction you should have if you don’t roll your own crypto.
It’s fun and not that bad really.
- AnotherGoodName 2y agoYeah I’ve done this for embedded devices. A website can be presented with nothing more than a raw socket and sending back a text string of http headers and html in a single text string when people connect to it. Hell if you’re really lazy you can forgo responding with the http headers and just socket.write(“hello world”) as the response and all the major browsers will render “hello world” to the user. Properly formatted http headers are just a text string extra and the html is just text. There’s not much to it.
- sph 2y agoWhy HTTP/1.1? Everybody speaks HTTP/1.0 and it is even simpler.
- matja 2y agoLack of IP(v4) addresses. HTTP/1.0 sends no Host header, so cannot implement name-based virtual hosts. HTTP/1.1 does.
- folmar 2y agoAnd TLS can be handle by kernel if you target linux only. https://docs.kernel.org/networking/tls.html https://docs.kernel.org/networking/tls.html