mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
test: Adds support to handle different content in log depending on the version
Some functionalities are just enabled on Apache, not part of nginx or IIS. As example we have the "proxy", currently just supported in Apache. This patches add to our regression test suite the ability to expect different contents based on the targert platform.
This commit is contained in:
parent
7ac515ee29
commit
7478faa5ce
@ -44,6 +44,9 @@ $UA->agent($UA_NAME);
|
||||
|
||||
$SIG{TERM} = $SIG{INT} = \&handle_interrupt;
|
||||
|
||||
|
||||
my $platform = "nginx";
|
||||
|
||||
my %opt;
|
||||
getopts('A:E:D:C:T:H:a:p:dvh', \%opt);
|
||||
|
||||
@ -233,6 +236,19 @@ sub runfile {
|
||||
for my $key (keys %{ $t{match_response} || {}}) {
|
||||
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
|
||||
my $m = $t{match_response}{$key};
|
||||
if (ref($m) eq "HASH") {
|
||||
if ($m->{$platform}) {
|
||||
$m = $m->{$platform};
|
||||
}
|
||||
else {
|
||||
my $ap = join(", ", keys %{$m});
|
||||
msg("Warning: trying to match response. Nothing " .
|
||||
"to match in current platform: $platform. " .
|
||||
"This test only contains cotent for: $ap.");
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $match = match_response($mtype, $resp, $m);
|
||||
if ($neg and defined $match) {
|
||||
$rc = 1;
|
||||
@ -266,6 +282,18 @@ sub runfile {
|
||||
for my $key (keys %{ $t{match_log} || {}}) {
|
||||
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
|
||||
my $m = $t{match_log}{$key};
|
||||
if (ref($m) eq "HASH") {
|
||||
if ($m->{$platform}) {
|
||||
$m = $m->{$platform};
|
||||
}
|
||||
else {
|
||||
my $ap = join(", ", keys %{$m});
|
||||
msg("Warning: trying to match: $mtype. Nothing " .
|
||||
"to match in current platform: $platform. " .
|
||||
"This test only contains cotent for: $ap.");
|
||||
last;
|
||||
}
|
||||
}
|
||||
my $match = match_log($mtype, @{$m || []});
|
||||
if ($neg and defined $match) {
|
||||
$rc = 1;
|
||||
|
@ -51,6 +51,8 @@ if ($HTTPD eq "\@APXS_HTTPD\@") {
|
||||
|
||||
$SIG{TERM} = $SIG{INT} = \&handle_interrupt;
|
||||
|
||||
my $platform = "apache";
|
||||
|
||||
my %opt;
|
||||
getopts('A:E:D:C:T:H:a:p:dvh', \%opt);
|
||||
|
||||
@ -230,6 +232,18 @@ sub runfile {
|
||||
for my $key (keys %{ $t{match_response} || {}}) {
|
||||
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
|
||||
my $m = $t{match_response}{$key};
|
||||
if (ref($m) eq "HASH") {
|
||||
if ($m->{$platform}) {
|
||||
$m = $m->{$platform};
|
||||
}
|
||||
else {
|
||||
my $ap = join(", ", keys %{$m});
|
||||
msg("Warning: trying to match: $mtype. Nothing " .
|
||||
"to match in current platform: $platform. " .
|
||||
"This test only contains cotent for: $ap.");
|
||||
last;
|
||||
}
|
||||
}
|
||||
my $match = match_response($mtype, $resp, $m);
|
||||
if ($neg and defined $match) {
|
||||
$rc = 1;
|
||||
@ -263,6 +277,18 @@ sub runfile {
|
||||
for my $key (keys %{ $t{match_log} || {}}) {
|
||||
my($neg,$mtype) = ($key =~ m/^(-?)(.*)$/);
|
||||
my $m = $t{match_log}{$key};
|
||||
if (ref($m) eq "HASH") {
|
||||
if ($m->{$platform}) {
|
||||
$m = $m->{$platform};
|
||||
}
|
||||
else {
|
||||
my $ap = join(", ", keys %{$m});
|
||||
msg("Warning: trying to match: $mtype. Nothing " .
|
||||
"to match in current platform: $platform. " .
|
||||
"This test only contains cotent for: $ap.");
|
||||
last;
|
||||
}
|
||||
}
|
||||
my $match = match_log($mtype, @{$m || []});
|
||||
if ($neg and defined $match) {
|
||||
$rc = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user