Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

BooK (2612)

BooK
  {book} {at} {cpan.org}
http://paris.mongueurs.net/
Yahoo! ID: philippe_bruhat (Add User, Send Message)

Obfuscation [plover.com]. Pink [axis-of-aevil.net]. HTTP::Proxy [cpan.org]. YEF [yapceurope.org]. Fishnet [perl.org]. Kapow [cpan.org]. Cog's [perl.org] bitch [cpan.org]. Invitation [perl.org]. White [perl.org] Camel [perl.org]. Nuff' said.

Journal of BooK (2612)

Tuesday February 18, 2003
06:46 PM

HTTP::Proxy now supports persistent connections!

[ #10654 ]

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...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Pity you didn't implement HTTP::Proxy using POE. No need to fork, better portability ...
    --

    Ilya Martynov (http://martynov.org/ [martynov.org])

    • 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

      • 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.
        --

        Ilya Martynov (http://martynov.org/ [martynov.org])