Yay! I finally managed to get some performance out of this module by allowing it to handle persistent connections in HTTP/1.1. This is all in version 0.07!
Sometimes there's no other way than cut'n'paste.
HTTP::Proxy is nothing more than a HTTP::Daemon and a LWP::UserAgent in close collaboration (as can be seen in merlyn's, Abigail's or rafael's code).
I did in fact paint myself in a corner by doing only what was rational: using the callback version of LWP::UserAgent simple_request() method. This enables the proxy to begin sending a response while it's still busy receiving it.
Well, HTTP::Daemon supports persistent connections, but the code that does this is in send_response() (which I didn't use at first...) works well with persistent connections when used with either a full response (which I cannot have, since I use a callback with LWP::UA) or a... callback as the content() of the HTTP::Response to send.
So I simply cut the perfect code for the task out of HTTP::Daemon, and pasted it in the callback that HTTP::Proxy gives to LWP::UA.
By now, I begin to find my way both in RFC 2616 and libwww-perl's source code. :-)
If only I could make this work under Windows...
Re:POE based proxy
BooK on 2003-03-19T17:13:47
Yeah, yeah, I've been told that several times.
:-) I'd like to work on a POE::Component that would do what HTTP::Proxy does. It's just that I was too lazy to learn POE. And I have so much to do until HTTP::Proxy is actually usable for more than simple HTTP requests to HTTP::Proxy (the filtering system is the most exciting part of HTTP::Proxy, and it need some more work, and a decent API). So I guess this will happen, but only later, someday.
I'll soon add the capability to answer CONNECT requests (based on my experience with connect-tunnel). I bet that using Crypt::SSLeay and HTTP::Proxy one could create a simple man-in-the-middle attack based on the fact that nobody really cares about the certificate they are sent. That is, assuming people would use such a proxy (for example, if they are lead to believe it is an open proxy).
Re:POE based proxy
IlyaM on 2003-03-19T17:47:17
Beware that POE is likely to require very different design of API (because it must be event based). If you decide at some point to port HTTP::Proxy to POE this port will not straight-forward.