A few years ago, I worked at a company whose webservers were hosted at a dedicated web-hosting company. The question rose whether their website could be reached at foo.bar as well as at www.foo.bar. Well, no problem you’d say, nothing that a simple A or CNAME record in DNS couldn’t fix. Not so, foo.bar had an A record assigned already for a host in the company’s DMZ that used to do a lot of stuff.
You can imagine adding a webserver to foo.bar, just to serve 301 moved permanently status codes seemed like a bit of overkill to me. And apart from that, I was too lazy to have another $many_lines_of_code to keep up to date for such a trivial task.
Thanks to the wonders of HTTP the solution was almost as simple as the problem.
I whipped up a small text file containing a static HTTP 301, and used the almighty
cat to glue this to a socket.
It worked like a charm. It was also great to see sites like Netcraft list the webserver of
I thought of this today, when I was playing a bit with my Nintendo DS running DSLinux. I could find various MP3 decoders, but nothing to do streaming. So I kludged together the other side of the hack that I explained above:
1 2 3 4 5 6 7
Et voila. Streaming audio. (In this case the Belgian music station Studio Brussel.) Thank you, sir Tim.