diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:38:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:38:31 +0000 |
commit | 252601302d45036817546c533743e5918b6b86e8 (patch) | |
tree | bfad3f5be123f000fdb03e26400050dece33d72f /tests/HTTPTest.pm | |
parent | Initial commit. (diff) | |
download | wget-252601302d45036817546c533743e5918b6b86e8.tar.xz wget-252601302d45036817546c533743e5918b6b86e8.zip |
Adding upstream version 1.21.3.upstream/1.21.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/HTTPTest.pm')
-rw-r--r-- | tests/HTTPTest.pm | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/HTTPTest.pm b/tests/HTTPTest.pm new file mode 100644 index 0000000..6225c7f --- /dev/null +++ b/tests/HTTPTest.pm @@ -0,0 +1,56 @@ +package HTTPTest; + +use strict; +use warnings; + +use HTTPServer; +use WgetTests; + +our @ISA = qw(WgetTest); +my $VERSION = 0.01; + +{ + my %_attr_data = ( # DEFAULT + ); + + sub _default_for + { + my ($self, $attr) = @_; + return $_attr_data{$attr} if exists $_attr_data{$attr}; + return $self->SUPER::_default_for($attr); + } + + sub _standard_keys + { + my ($self) = @_; + ($self->SUPER::_standard_keys(), keys %_attr_data); + } +} + +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; + + $self->{_server}->run($self->{_input}, $synch_func); +} + +sub _substitute_port +{ + my $self = shift; + my $ret = shift; + $ret =~ s/\Q{{port}}/$self->{_server}->sockport/eg; + return $ret; +} + +1; + +# vim: et ts=4 sw=4 |