From c9cf025fadfe043f0f2f679e10d1207d8a158bb6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:01:31 +0200 Subject: Adding debian version 2.4.57-2. Signed-off-by: Daniel Baumann --- debian/perl-framework/t/modules/vhost_alias.t | 101 ++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 debian/perl-framework/t/modules/vhost_alias.t (limited to 'debian/perl-framework/t/modules/vhost_alias.t') diff --git a/debian/perl-framework/t/modules/vhost_alias.t b/debian/perl-framework/t/modules/vhost_alias.t new file mode 100644 index 0000000..a89a97b --- /dev/null +++ b/debian/perl-framework/t/modules/vhost_alias.t @@ -0,0 +1,101 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil; +use Apache::TestRequest; + +my $htdocs = Apache::Test::vars('documentroot'); +my $url = '/index.html'; +my $cgi_name = "test-cgi"; +my $cgi_string = "test cgi for"; +my $root = "$htdocs/modules/vhost_alias"; +my $ext; + +my @vh = qw(www.vha-test.com big.server.name.from.heck.org ab.com w-t-f.net); + +plan tests => @vh * 2, need need_module('vhost_alias'), need_cgi, need_lwp; + +Apache::TestRequest::scheme('http'); #ssl not listening on this vhost +Apache::TestRequest::module('mod_vhost_alias'); #use this module's port + +## test environment setup ## +t_mkdir($root); + +foreach (@vh) { + my @part = split /\./, $_; + my $d = "$root/"; + + ## create VirtualDocumentRoot htdocs/modules/vhost_alias/%2/%1.4/%-2/%2+ + ## %2 ## + if ($part[1]) { + $d .= $part[1]; + } else { + $d .= "_"; + } + t_mkdir($d); + + $d .= "/"; + ## %1.4 ## + if (length($part[0]) < 4) { + $d .= "_"; + } else { + $d .= substr($part[0], 3, 1); + } + t_mkdir($d); + + $d .= "/"; + ## %-2 ## + if ($part[@part-2]) { + $d .= $part[@part-2]; + } else { + $d .= "_"; + } + t_mkdir($d); + + $d .= "/"; + ## %2+ ## + for (my $i = 1;$i < @part;$i++) { + $d .= $part[$i]; + $d .= "." if $part[$i+1]; + } + t_mkdir($d); + + ## write index.html for the VirtualDocumentRoot ## + t_write_file("$d$url",$_); + + ## create directories for VirtualScriptAlias tests ## + $d = "$root/$_"; + t_mkdir($d); + $d .= "/"; + + ## write cgi ## + my $cgi_content = < $_), + $_, + "VirtalDocumentRoot test" + ); + + ## test VirtualScriptAlias ## + my $cgi_uri = "/cgi-bin/$cgi_name.$ext"; + my $actual = GET_BODY $cgi_uri, Host => $_; + $actual =~ s/[\r\n]+$//; + ok t_cmp($actual, + "$cgi_string $_", + "VirtualScriptAlias test" + ); +} + + -- cgit v1.2.3