(httpd-tests) branch trunk updated: 2.4.68 expr updates (#18)
[email protected] Fri, 05 Jun 2026 10:42:29 +0000
| Newsgroups | gmane.comp.apache.cvs |
|---|---|
| Message-ID | <[email protected]> |
This is an automated email from the ASF dual-hosted git repository.
covener pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/httpd-tests.git
The following commit(s) were added to refs/heads/trunk by this push:
new c45f32cd 2.4.68 expr updates (#18)
c45f32cd is described below
commit c45f32cd44cf15aca0253dc480fe687b2e4d76ff
Author: Eric Covener <[email protected]>
AuthorDate: Fri Jun 5 06:42:22 2026 -0400
2.4.68 expr updates (#18)
Co-authored-by: Eric Covener <[email protected]>
---
t/apache/expr.t | 9 ++++----
t/modules/headers.t | 61 ++++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 51 insertions(+), 19 deletions(-)
diff --git a/t/apache/expr.t b/t/apache/expr.t
index 7d62bc04..06e031d0 100644
--- a/t/apache/expr.t
+++ b/t/apache/expr.t
@@ -115,7 +115,6 @@ my @test_cases = (
[ q[toupper(escape('?')) = '%3F' ] => 1 ],
[ q[tolower(toupper(escape('?'))) = '%3f' ] => 1 ],
[ q[%{toupper:%{escape:?}} = '%3F' ] => 1 ],
- [ q[file('] . $file_foo . q[') = 'foo\n' ] => 1 ],
# unary operators
[ q[-n ''] => 0 ],
[ q[-z ''] => 1 ],
@@ -198,11 +197,13 @@ push @test_cases, @bool_test_cases;
push @test_cases, map { ["!($_->[0])" => neg($_->[1]) ] } @bool_test_cases;
if (have_min_apache_version("2.3.13")) {
+ my $restrict2_result = have_min_apache_version('2.4.68') ? undef : 1;
push(@test_cases, (
# functions
- [ q[filesize('] . $file_foo . q[') = 4 ] => 1 ],
- [ q[filesize('] . $file_notexist . q[') = 0 ] => 1 ],
- [ q[filesize('] . $file_zero . q[') = 0 ] => 1 ],
+ [ q[filesize('] . $file_foo . q[') = 4 ] => $restrict2_result ],
+ [ q[filesize('] . $file_notexist . q[') = 0 ] => $restrict2_result ],
+ [ q[filesize('] . $file_zero . q[') = 0 ] => $restrict2_result ],
+ [ q[file('] . $file_foo . q[') = 'foo\n' ] => $restrict2_result ],
# unary operators
[ qq[-d '$file_foo' ] => 0 ],
[ qq[-e '$file_foo' ] => 1 ],
diff --git a/t/modules/headers.t b/t/modules/headers.t
index 4892b95c..40bd5c32 100644
--- a/t/modules/headers.t
+++ b/t/modules/headers.t
@@ -115,7 +115,27 @@ my @testcases = (
[ ],
[ 'Test-Header' => 'foo' ],
],
+ # 500 error test - invalid regex pattern
+ [
+ "Header edit Test-Header (unclosed bar", # malformed regex (unmatched parenthesis)
+ [ ],
+ [ ],
+ 500,
+ ],
);
+if (have_min_apache_version('2.4.68')) {
+ push(@testcases,
+ (
+ # edit*
+ [
+ "Header set Test-Header \"expr=%{base64:%{file:$htaccess}}\"", # no file() in htaccess
+ [ ],
+ [ ],
+ 500,
+ ],
+ )
+ );
+}
if (have_min_apache_version('2.5.1')) {
push(@testcases,
(
@@ -297,6 +317,9 @@ sub test_header2 {
my @test = @_;
my $h = HTTP::Headers->new;
+ # Extract expected status code (default to 200 if not specified)
+ my $expected_status = $test[0][3] // 200;
+
print "\n\n\n";
for (my $i = 0; $i < scalar @{$test[0][1]}; $i += 2) {
print "Header sent n°" . $i/2 . ":\n";
@@ -312,22 +335,30 @@ sub test_header2 {
##
my $r = HTTP::Request->new('GET', "http://$hostport/modules/headers/htaccess/", $h);
my $res = $ua->request($r);
- ok t_cmp($res->code, 200, "Checking return code is '200'");
+ ok t_cmp($res->code, $expected_status, "Checking return code is '$expected_status'");
- my $isok = 1;
- for (my $i = 0; $i < scalar @{$test[0][2]}; $i += 2) {
- print "\n";
- print "Header received n°" . $i/2 . ":\n";
- print " header: " . $test[0][2][$i] . "\n";
- print " expected: " . $test[0][2][$i+1] . "\n";
- if ($res->header($test[0][2][$i])) {
- print " received: " . $res->header($test[0][2][$i]) . "\n";
- } else {
- print " received: <undefined>\n";
+ # Only validate headers if we expect a successful response
+ if ($expected_status == 200) {
+ my $isok = 1;
+ for (my $i = 0; $i < scalar @{$test[0][2]}; $i += 2) {
+ print "\n";
+ print "Header received n°" . $i/2 . ":\n";
+ print " header: " . $test[0][2][$i] . "\n";
+ print " expected: " . $test[0][2][$i+1] . "\n";
+ if ($res->header($test[0][2][$i])) {
+ print " received: " . $res->header($test[0][2][$i]) . "\n";
+ } else {
+ print " received: <undefined>\n";
+ }
+ $isok = $isok && $res->header($test[0][2][$i]) && $test[0][2][$i+1] eq $res->header($test[0][2][$i]);
}
- $isok = $isok && $res->header($test[0][2][$i]) && $test[0][2][$i+1] eq $res->header($test[0][2][$i]);
- }
- print "\nResponse received is:\n" . $res->as_string;
+ print "\nResponse received is:\n" . $res->as_string;
- ok $isok;
+ ok $isok;
+ } else {
+ # For error responses, skip header validation
+ print "\nExpected error response received (status $expected_status)\n";
+ print "Response received is:\n" . $res->as_string;
+ ok 1;
+ }
}