Any-Daemon-HTTP

 view release on metacpan or  search on metacpan

lib/Any/Daemon/HTTP.pod  view on Meta::CPAN


[0.24] maximum number of HTTP requests accepted by all connections for
one process.

=item max_req_per_conn => INTEGER

[0.24] maximum number of HTTP requests handled in one connection.

=item max_time_per_conn => SECONDS

Maximum time a connection will stay alive.  When the time expires, the
process will forcefully killed.  For each request, C<req_time_bonus>
seconds are added.  This may be a bit short when your files are large.

=item new_child => CODE|METHOD

[0.28] run code when a new child process is started.  This will run
before the task starts waiting for connections.  See L<newChild()|Any::Daemon::HTTP/"Action">

=item new_connection => CODE|METHOD

lib/Any/Daemon/HTTP/Proxy.pm  view on Meta::CPAN

use LWP::UserAgent ();
use HTTP::Status   qw(HTTP_TOO_MANY_REQUESTS);
use Time::HiRes    qw(time);


sub init($)
{   my ($self, $args) = @_;
    $self->SUPER::init($args);

    $self->{ADHDP_ua}  = $args->{user_agent}
      || LWP::UserAgent->new(keep_alive => 30);

    $self->{ADHDP_via} = $args->{via};
    if(my $fm = $args->{forward_map})
    {   $self->{ADHDP_map}   = $fm eq 'RELAY' ? sub {$_[3]} : $fm;
    }

    if(my $rem = $args->{remote_proxy})
    {   $self->{ADHDP_proxy} = ref $rem eq 'CODE' ? $rem : sub {$rem};
    }



( run in 2.379 seconds using v1.01-cache-2.11-cpan-df04353d9ac )