3 ms·
I didn't check the link, but I bet that "HTTP server in one line of code" doesn't include a TCP stack.
by mkj 10y ago
I didn't check the link, but I bet that "HTTP server in one line of code" doesn't include a TCP stack.
- liviu- 10y agoThe "one-line" server is just multiple commands separated by ';' and joined into one line. At best a pointless exercise, and at worst a deceiving one.
- kraftman 10y agoDid you know you can rewrite jQuery in just 4 lines of code? https://code.jquery.com/jquery-2.2.4.min.js https://code.jquery.com/jquery-2.2.4.min.js
- majewsky 10y agoNo, it runs nc(1) plus a shell script.
- pfg 10y agoPrecisely - and just like that one line of code is enough to spawn a HTTP server, a different line of code could be enough to spawn a HTTPS server. It's a matter of improving the tooling. No one is advocating to disable HTTP today, what browser vendors are trying to do is get the ecosystem to a point where that's possible without a significant increase in cost for site operators. Similarly, HTTP/2 has been tuned specifically for (typically high-latency, low-bandwidth) mobile connections and is practically (at least) indistinguishable from the speed of (optimized) HTTP. This is only going to improve with things like Zero-RTT handshakes coming with TLS 1.3.
- mrweasel 10y agoIt uses Netcat, and it would be much more readable if it where more lines. I suppose you could take some small web server, written in C, and just remove all newlines, but what's the point really. The article seems to overlook on aspect of https. It's much easier for the site operator to just serve everything over https. We tried the whole "switch the user to https" when needed years ago. It was cumbersome and we often got it wrong and exposed traffic that was suppose to be encrypted. The point is well made. We don't NEED https all the time. It's just easier and most of our connections and devices don't care about the overhead.
- laurent123456 10y agoAnything can be done in one line when using existing tools that are made of thousands of lines. This is also a one line web server: python -m SimpleHTTPServer 8080