As I currently spend my well-deserved holidays (at home, BTW), I thought about writing a piece of software that I haven't written before, simply to improve my skills. So, after two beers, I decided on writing a simple HTTP proxy (not caching), and after a day an an evening of work, I can present
cuttle, a simple HTTP proxy written in pure Ruby. So far,
GET and
POST requests have been tested and seem to work. And it is really slow. And it eats about 99 % of the available CPU time. That's because both the design and the implementation are fucked up. The design is fucked up because (i) it is multithreaded (Ruby threads are totally independent from the operating systems underneath, and thus available on all platforms where Ruby is available, but also totally inefficient; threads can even starve, according to the documentation, suggesting bad scheduling) (ii) it consists of two main thread, one accepting incoming connections and putting them in a list, and another one that takes the connections and starts a worker thread for each connection. The implementation is fucked up because the thread that starts the worker threads continuously polls the list.
I think I will take out the second thread, and the first thread starts the worker threads by itself. But right now, I'm too tired to do that.
BTW: this weblog entry was posted via cuttle. So it is at least robust enough to use it for blogging.