summaryrefslogtreecommitdiff
path: root/tests/LightyTest.pm
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2007-08-18 10:40:20 +0000
committerJan Kneschke <jan@kneschke.de>2007-08-18 10:40:20 +0000
commit5bc539b63e56525235eda504894e7919c3c18866 (patch)
tree399ded4d8ffbb9870277979ee1fa914981226f64 /tests/LightyTest.pm
parentc4e3150283f81fc4a87c600f2d19634c39934a7b (diff)
downloadlighttpd-git-5bc539b63e56525235eda504894e7919c3c18866.tar.gz
don't send a Content-Length for 1xx, 204 and 304 (fixes #1002)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1946 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/LightyTest.pm')
-rwxr-xr-xtests/LightyTest.pm32
1 files changed, 22 insertions, 10 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm
index 0426d45e..33eca612 100755
--- a/tests/LightyTest.pm
+++ b/tests/LightyTest.pm
@@ -235,9 +235,7 @@ sub handle_http {
diag(sprintf("body failed: expected '%s', got '%s'\n", $href->{'HTTP-Content'}, $resp_body));
return -1;
}
- }
-
- if (defined $href->{'-HTTP-Content'}) {
+ } elsif (defined $href->{'-HTTP-Content'}) {
if (defined $resp_body && $resp_body ne '') {
diag(sprintf("body failed: expected empty body, got '%s'\n", $resp_body));
return -1;
@@ -245,6 +243,7 @@ sub handle_http {
}
foreach (keys %{ $href }) {
+ ## filter special keys
next if $_ eq 'HTTP-Protocol';
next if $_ eq 'HTTP-Status';
next if $_ eq 'HTTP-Content';
@@ -252,20 +251,33 @@ sub handle_http {
(my $k = $_) =~ tr/[A-Z]/[a-z]/;
- my $no_val = 0;
+ my $verify_value = 1;
+ my $key_inverted = 0;
if (substr($k, 0, 1) eq '+') {
+ ## the key has to exist, but the value is ignored
$k = substr($k, 1);
- $no_val = 1;
-
+ $verify_value = 0;
+ } elsif (substr($k, 0, 1) eq '-') {
+ ## the key should NOT exist
+ $k = substr($k, 1);
+ $key_inverted = 1;
+ $verify_value = 0; ## skip the value check
}
- if (!defined $resp_hdr{$k}) {
- diag(sprintf("required header '%s' is missing\n", $k));
- return -1;
+ if ($key_inverted) {
+ if (defined $resp_hdr{$k}) {
+ diag(sprintf("required header '%s' is missing\n", $k));
+ return -1;
+ }
+ } else {
+ if (not defined $resp_hdr{$k}) {
+ diag(sprintf("required header '%s' is missing\n", $k));
+ return -1;
+ }
}
- if ($no_val == 0) {
+ if ($verify_value) {
if ($href->{$_} =~ /^\/(.+)\/$/) {
if ($resp_hdr{$k} !~ /$1/) {
diag(sprintf("response-header failed: expected '%s', got '%s', regex: %s\n",