1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00
wget/tests/HTTPTest.pm

57 lines
1007 B
Perl
Raw Normal View History

package HTTPTest;
use strict;
use warnings;
use HTTPServer;
2014-09-24 10:40:03 -04:00
use WgetTests;
our @ISA = qw(WgetTest);
my $VERSION = 0.01;
{
my %_attr_data = ( # DEFAULT
);
2007-06-14 11:59:23 -04:00
sub _default_for
{
my ($self, $attr) = @_;
return $_attr_data{$attr} if exists $_attr_data{$attr};
2007-06-14 11:59:23 -04:00
return $self->SUPER::_default_for($attr);
}
sub _standard_keys
2007-06-14 11:59:23 -04:00
{
my ($self) = @_;
2007-06-14 11:59:23 -04:00
($self->SUPER::_standard_keys(), keys %_attr_data);
}
}
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!!!";
}
sub _launch_server {
my $self = shift;
my $synch_func = shift;
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;
}
1;
# vim: et ts=4 sw=4