Twisted - Proxy in 7 lines
Filed Under:
You can find the example here, where you will also find some information and links to Twisted.
Before I picked up Twisted, I actually picked up a Java Servlets book. Experience gained from earlier projects, taught me that there is a need for simple, lightweight and fast network application servers to do jobs like this, especially if you need to do atomic operations that require input from different sources. Actually Servlets do the job well and the javax.* libraries are also not so verbose. If it wasn't for a Python preference, I'd probably use Java servlets instead for this role. You may want to investigate similar libraries for your favorite language too. It's a good tool to add to your development toolkit.
Update:
Additional testing showed that for streaming http audio requests, it does not close the connection when the client stops. Even if the request is via a squid client proxy. A Proxy class instance continues to download . This is a good learning experience, as I'll need to extend the simple example to show HTTP headers to see what's the difference with other requests which are handled correctly, and then deal with the streaming audio proxy instances.

Great!