2005-12-05 08:35:07 -05:00
|
|
|
package HTTPTest;
|
|
|
|
|
|
|
|
use strict;
|
2008-11-12 15:18:27 -05:00
|
|
|
use warnings;
|
2005-12-05 08:35:07 -05:00
|
|
|
|
|
|
|
use HTTPServer;
|
2007-07-12 02:10:48 -04:00
|
|
|
use WgetTest;
|
2006-01-24 07:15:58 -05:00
|
|
|
|
2007-07-12 02:10:48 -04:00
|
|
|
our @ISA = qw(WgetTest);
|
2006-01-24 07:15:58 -05:00
|
|
|
my $VERSION = 0.01;
|
2005-12-05 08:35:07 -05:00
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
my %_attr_data = ( # DEFAULT
|
|
|
|
);
|
|
|
|
|
2007-06-14 11:59:23 -04:00
|
|
|
sub _default_for
|
|
|
|
{
|
|
|
|
my ($self, $attr) = @_;
|
2005-12-05 08:35:07 -05:00
|
|
|
return $_attr_data{$attr} if exists $_attr_data{$attr};
|
2007-06-14 11:59:23 -04:00
|
|
|
return $self->SUPER::_default_for($attr);
|
|
|
|
}
|
2005-12-05 08:35:07 -05:00
|
|
|
|
2007-06-14 11:59:23 -04:00
|
|
|
sub _standard_keys
|
|
|
|
{
|
2005-12-05 08:35:07 -05:00
|
|
|
my ($self) = @_;
|
2007-06-14 11:59:23 -04:00
|
|
|
($self->SUPER::_standard_keys(), keys %_attr_data);
|
|
|
|
}
|
2005-12-05 08:35:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-12 05:18:35 -04:00
|
|
|
sub _setup_server {
|
|
|
|
my $self = shift;
|
|
|
|
$self->{_server} = HTTPServer->new (LocalAddr => 'localhost',
|
|
|
|
ReuseAddr => 1)
|
|
|
|
or die "Cannot create server!!!";
|
|
|
|
}
|
2005-12-05 08:35:07 -05:00
|
|
|
|
|
|
|
|
2006-01-24 07:15:58 -05:00
|
|
|
sub _launch_server {
|
2005-12-05 08:35:07 -05:00
|
|
|
my $self = shift;
|
2006-05-29 05:15:06 -04:00
|
|
|
my $synch_func = shift;
|
2005-12-05 08:35:07 -05:00
|
|
|
|
2008-06-12 05:18:35 -04:00
|
|
|
$self->{_server}->run ($self->{_input}, $synch_func);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub _substitute_port {
|
|
|
|
my $self = shift;
|
|
|
|
my $ret = shift;
|
|
|
|
$ret =~ s/{{port}}/$self->{_server}->sockport/eg;
|
|
|
|
return $ret;
|
2005-12-05 08:35:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: et ts=4 sw=4
|
|
|
|
|