develooper Front page | perl.libwww | Postings from November 2001

keep alive update

Thread Next
Bill Moseley
November 8, 2001 11:24
keep alive update
Message ID:
Looking at some older code I see I was jumping through hoops for keep alives.

What I want is a way to nicely handle the situation where keep alive
support isn't available for the current LWP installation.

    if ( $server->keep_alive ) {

        eval 'require LWP::Protocol::http11;';
        if ( $@ ) {
            warn "Cannot use keep alives -- $@\n";
        } else {
            LWP::Protocol::implementor('http', 'LWP::Protocol::http11');
    } else {
        require LWP::Protocol::http;
        LWP::Protocol::implementor('http', 'LWP::Protocol::http');

Also, how can I report the number of connections?  I'd like to see how many
connections compared to number of requests.  Also, how do I determine how
large to set the connection cache?  

For example, say I'm spidering my own site, so I want keep_alive set.  I'm
also validating links to our image server, so I want keep alive's there.
I'm also validating links to remote sites, where I don't really need keep


Bill Moseley

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About