summaryrefslogtreecommitdiff
path: root/tests/mod-redirect.t
diff options
context:
space:
mode:
authorArno Töll <arno@debian.org>2012-11-21 23:57:42 +0100
committerArno Töll <arno@debian.org>2012-11-21 23:57:42 +0100
commit47236ea4c1d5601fc6bea1b280d36152ec5ff32b (patch)
tree89c109c0bef460fa747a3413610034002fac1cb4 /tests/mod-redirect.t
parentdae92c799e85ec3b65f46da6a776e4386bc99d6c (diff)
downloadlighttpd-47236ea4c1d5601fc6bea1b280d36152ec5ff32b.tar.gz
Imported Upstream version 1.4.32
Diffstat (limited to 'tests/mod-redirect.t')
-rwxr-xr-xtests/mod-redirect.t20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/mod-redirect.t b/tests/mod-redirect.t
index 666ca80..14669d9 100755
--- a/tests/mod-redirect.t
+++ b/tests/mod-redirect.t
@@ -1,19 +1,19 @@
#!/usr/bin/env perl
BEGIN {
- # add current source dir to the include-path
- # we need this for make distcheck
- (my $srcdir = $0) =~ s#/[^/]+$#/#;
- unshift @INC, $srcdir;
+ # add current source dir to the include-path
+ # we need this for make distcheck
+ (my $srcdir = $0) =~ s,/[^/]+$,/,;
+ unshift @INC, $srcdir;
}
use strict;
use IO::Socket;
-use Test::More tests => 6;
+use Test::More tests => 7;
use LightyTest;
my $tf = LightyTest->new();
my $t;
-
+
ok($tf->start_proc == 0, "Starting lighttpd") or die();
$t->{REQUEST} = ( <<EOF
@@ -24,6 +24,14 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/' } ];
ok($tf->handle_http($t) == 0, 'external redirect');
+$t->{REQUEST} = ( <<EOF
+GET /redirect/ HTTP/1.0
+Host: vvv.example.org
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://localhost:'.$tf->{PORT}.'/', 'Content-Length' => '0' } ];
+ok($tf->handle_http($t) == 0, 'external redirect should have a Content-Length: 0');
+
$t->{REQUEST} = ( <<EOF
GET /redirect/ HTTP/1.0
Host: zzz.example.org