Hacker News new | ask | show | jobs
by xaduha 1863 days ago
Only one mention of socat, nothing does ad-hoc nonsense that you probably would never use again like socat.

> socat TCP4-LISTEN:50000,fork EXEC:/usr/bin/ifconfig

> curl --http0.9 localhost:50000

Hmmm, does http v0.9 count?

1 comments

Probably because the example you made doesn't look like a static file server, it seems to execute a specific unix command on incoming request only. The rest of the examples from the gist is proper static file servers.

I'd be interested in seeing if you can come up with a socat one-liner that works like a static file server. Would come in handy for many things, but I can't seem to figure out how to make it work.

Many examples here in the comments and in the gist itself don't follow it to the letter either, it's easy enough to serve one file.

This one might work https://github.com/avleen/bashttpd

> socat TCP4-LISTEN:8080 EXEC:/usr/local/bin/bashttpd

> Many examples here in the comments and in the gist itself don't follow it to the letter either, it's easy enough to serve one file.

Curious about what you said, I looked through the gist again and every one of the examples in the gist itself does indeed serve all the files under a path (a "static file server"). Which one are you implying does not?