This is useless for anything practical, since most web sites use HTTPS now, and it’s not even remotely generalised enough for all web sites or file types.
It’s really just a basic demo of using sockets and socket streams.
Modifying this I was able to confirm that it wasn’t just me, Emscripten really don’t support sockets.
I’ve always gotten error “-1” whatever that means, and it’s the same with this example.