summaryrefslogtreecommitdiff
path: root/tests/core-response.t
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-06-12 09:09:28 +0000
committerJan Kneschke <jan@kneschke.de>2005-06-12 09:09:28 +0000
commit5986add693bba651592403b3b74e25d1ad855c37 (patch)
treec80e91afa1fd7f1a17c1061418b921dc5479e932 /tests/core-response.t
parentd185991460d72040cc462fde15bdb22fb4eb3bb2 (diff)
downloadlighttpd1.4-5986add693bba651592403b3b74e25d1ad855c37.tar.gz
lighttpd1.4-5986add693bba651592403b3b74e25d1ad855c37.zip
Quote ETag, fixes #117
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@376 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/core-response.t')
-rwxr-xr-xtests/core-response.t30
1 files changed, 25 insertions, 5 deletions
diff --git a/tests/core-response.t b/tests/core-response.t
index 6bbb63c6..844a4295 100755
--- a/tests/core-response.t
+++ b/tests/core-response.t
@@ -2,7 +2,7 @@
use strict;
use IO::Socket;
-use Test::More tests => 10;
+use Test::More tests => 12;
my $basedir = (defined $ENV{'top_builddir'} ? $ENV{'top_builddir'} : '..');
my $srcdir = (defined $ENV{'srcdir'} ? $ENV{'srcdir'} : '.');
@@ -172,10 +172,16 @@ sub handle_http {
return -1;
}
- if ($no_val == 0 &&
- $href->{$_} ne $resp_hdr{$k}) {
- diag(sprintf("response-header failed: expected '%s', got '%s'\n", $href->{$_}, $resp_hdr{$k}));
- return -1;
+ if ($no_val == 0) {
+ if ($href->{$_} =~ /^\/(.+)\/$/ && $resp_hdr{$k} !~ /$1/) {
+ diag(sprintf("response-header failed: expected '%s', got '%s', regex: %s\n",
+ $href->{$_}, $resp_hdr{$k}, $1));
+ return -1;
+ } elsif ($href->{$_} ne $resp_hdr{$k}) {
+ diag(sprintf("response-header failed: expected '%s', got '%s'\n",
+ $href->{$_}, $resp_hdr{$k}));
+ return -1;
+ }
}
}
}
@@ -206,6 +212,20 @@ EOF
@response = ( { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400, 'Connection' => 'close' } );
ok(handle_http == 0, 'Host missing');
+@request = ( <<EOF
+GET / HTTP/1.0
+EOF
+ );
+@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+ETag' => '' } );
+ok(handle_http == 0, 'ETag is set');
+
+@request = ( <<EOF
+GET / HTTP/1.0
+EOF
+ );
+@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'ETag' => '/^".+"$/' } );
+ok(handle_http == 0, 'ETag has quotes');
+
## Low-Level Response-Header Parsing - Content-Length