Agent-TCLI-Package-Net
view release on metacpan or search on metacpan
lib/Agent/TCLI/Package/Net/HTTP.pm view on Meta::CPAN
=cut
use warnings;
use strict;
use Object::InsideOut qw(Agent::TCLI::Package::Base);
use POE;
use POE::Component::Client::HTTP;
use POE::Component::Client::Keepalive;
use HTTP::Request::Common qw(GET POST);
use Agent::TCLI::Command;
use Agent::TCLI::Parameter;
use Getopt::Lucid qw(:all);
our $VERSION = '0.030.'.sprintf "%04d", (qw($Id: HTTP.pm 74 2007-06-08 00:42:53Z hacker $))[2];
=head2 ATTRIBUTES
The following attributes are accessible through standard <attribute>
methods unless otherwise noted.
lib/Agent/TCLI/Package/Net/HTTP.pm view on Meta::CPAN
'ResponseProgress', #progress callback
'', #proxy override
);
}
sub ResponseProgress {
my ($kernel, $self, $gen_args, $call_args) =
@_[KERNEL, OBJECT, ARG0, ARG1 ];
$self->Verbose("ResponseProgress: \tEntering ".$self->name." " );
my $req = $gen_args->[0]; # HTTP::Request object being serviced
my $tag = $gen_args->[1]; # Request ID tag from.
my $got = $call_args->[0]; # Number of bytes retrieved so far.
my $tot = $call_args->[1]; # Total bytes to be retrieved.
my $oct = $call_args->[2]; # Chunk of raw octets received this time.
my $percent = $got / $tot * 100;
# printf(
# "-- %.0f%% [%d/%d]: %s\n", $percent, $got, $tot, $req->uri()
# );
lib/Agent/TCLI/Package/Net/HTTPD.pm view on Meta::CPAN
=cut
use warnings;
use strict;
use Object::InsideOut qw(Agent::TCLI::Package::Base);
use POE;
use POE::Component::Server::SimpleHTTP;
use HTTP::Request::Common qw(GET POST);
use Agent::TCLI::Command;
use Agent::TCLI::Parameter;
require FormValidator::Simple;
FormValidator::Simple->import('NetAddr::IP');
our $VERSION = '0.030.'.sprintf "%04d", (qw($Id: HTTPD.pm 74 2007-06-08 00:42:53Z hacker $))[2];
=head2 ATTRIBUTES
lib/Agent/TCLI/Package/Net/HTTPD.pm view on Meta::CPAN
}
=item BeGone
This POE Event handler is used as a target event for URIs. It simply drops the
connection. It will log the conenction if logging is turned on.
=cut
sub BeGone {
# ARG0 = HTTP::Request object, ARG1 = HTTP::Response object,
# ARG2 = the DIR that matched
my ($kernel, $self, $request, $response, $dirmatch ) =
@_[KERNEL, OBJECT, ARG0 .. ARG2 ];
my $port = $response->connection->local_port;
# Do our stuff to HTTP::Response
$response->code( 0 );
$kernel->call($self->name => 'Log' => $request, $response ) if $self->logging;
lib/Agent/TCLI/Package/Net/HTTPD.pm view on Meta::CPAN
=item OK200
This POE Event handler is used as a target event for URIs. It will
send an HTTP response code of 200 with the content 'OK'.
It will log the conenction if logging is turned on.
=cut
sub OK200 {
# ARG0 = HTTP::Request object, ARG1 = HTTP::Response object,
# ARG2 = the DIR that matched
my ($kernel, $self, $request, $response, $dirmatch ) =
@_[KERNEL, OBJECT, ARG0, ARG1, ARG2 ];
my $port = $response->connection->local_port;
# Do our stuff to HTTP::Response
$response->code( 200 );
$response->content( 'OK' );
lib/Agent/TCLI/Package/Net/HTTPD.pm view on Meta::CPAN
=item NA404
This POE Event handler is used as a target event for URIs. It will
send an HTTP response code of 404 with an error message.
It will log the conenction if logging is turned on.
=cut
sub NA404 {
# ARG0 = HTTP::Request object, ARG1 = HTTP::Response object,
# ARG2 = the DIR that matched
my ($kernel, $self, $request, $response, $dirmatch ) =
@_[KERNEL, OBJECT, ARG0 .. ARG2 ];
my $port = $response->connection->local_port;
# Check for errors
if ( ! defined $request ) {
$_[KERNEL]->post( 'HTTPD'.$port, 'DONE', $response );
return;
( run in 0.264 second using v1.01-cache-2.11-cpan-de7293f3b23 )