summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/modules/ratelimit.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-07 02:04:07 +0000
commit1221c736f9a90756d47ea6d28320b6b83602dd2a (patch)
treeb453ba7b1393205258c9b098a773b4330984672f /debian/perl-framework/t/modules/ratelimit.t
parentAdding upstream version 2.4.38. (diff)
downloadapache2-debian.tar.xz
apache2-debian.zip
Adding debian version 2.4.38-3+deb10u8.debian/2.4.38-3+deb10u8debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/perl-framework/t/modules/ratelimit.t')
-rw-r--r--debian/perl-framework/t/modules/ratelimit.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/debian/perl-framework/t/modules/ratelimit.t b/debian/perl-framework/t/modules/ratelimit.t
new file mode 100644
index 0000000..27ce3a8
--- /dev/null
+++ b/debian/perl-framework/t/modules/ratelimit.t
@@ -0,0 +1,43 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestRequest;
+use Apache::TestUtil;
+use MIME::Base64;
+use Data::Dumper;
+use HTTP::Response;
+use Socket;
+
+use LWP::UserAgent ();
+
+
+my @testcases = (
+ ['/apache/ratelimit/' => '200', "ratelimited small file"],
+ ['/apache/ratelimit/autoindex/' => '200', "ratelimited small autoindex output"],
+ ['/apache/ratelimit/chunk?0,8192' => '200', "ratelimited chunked response"],
+);
+
+plan tests => scalar @testcases, need need_lwp,
+ need_module('mod_ratelimit'),
+ need_module('mod_autoindex'),
+ need_min_apache_version('2.4.35');
+
+my $ua = LWP::UserAgent->new;
+$ua->timeout(4);
+
+foreach my $t (@testcases) {
+ my $r;
+
+ # trap a die() in WLP when the the status line is invalid to avoid
+ # 'dubious test...' instead of just a failure.
+ eval { $r = GET($t->[0]) ;
+ chomp $r;
+ t_debug "Status Line: '" . $r->status_line . "'";
+ ok t_cmp($r->code, $t->[1], $t->[2]);
+ };
+ # Check if the eval() die'ed
+ ok t_cmp($@, undef, $t->[2]) if $@
+
+}
+