lighttpd 1.4.x
https://www.lighttpd.net/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
2.7 KiB
92 lines
2.7 KiB
6 years ago
|
#!/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;
|
||
|
}
|
||
|
|
||
|
use strict;
|
||
|
use Test::More tests => 10;
|
||
|
use LightyTest;
|
||
|
|
||
|
my $tf = LightyTest->new();
|
||
|
my $t;
|
||
|
|
||
|
SKIP: {
|
||
|
skip "no scgi-responder found", 11 unless -x $tf->{BASEDIR}."/tests/scgi-responder" || -x $tf->{BASEDIR}."/tests/scgi-responder.exe";
|
||
|
|
||
|
$tf->{CONFIGFILE} = 'scgi-responder.conf';
|
||
|
ok($tf->start_proc == 0, "Starting lighttpd with $tf->{CONFIGFILE}") or die();
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /index.scgi?lf HTTP/1.0
|
||
|
Host: www.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'line-ending \n\n');
|
||
|
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /index.scgi?crlf HTTP/1.0
|
||
|
Host: www.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'line-ending \r\n\r\n');
|
||
|
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /index.scgi?slow-lf HTTP/1.0
|
||
|
Host: www.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'line-ending \n + \n');
|
||
|
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /index.scgi?slow-crlf HTTP/1.0
|
||
|
Host: www.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'line-ending \r\n + \r\n');
|
||
|
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /abc/def/ghi?path_info HTTP/1.0
|
||
|
Host: wsgi.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '/abc/def/ghi' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'PATH_INFO (wsgi)');
|
||
|
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /abc/def/ghi?script_name HTTP/1.0
|
||
|
Host: wsgi.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'SCRIPT_NAME (wsgi)');
|
||
|
|
||
|
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /index.scgi?die-at-end HTTP/1.0
|
||
|
Host: www.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'killing scgi and wait for restart');
|
||
|
|
||
|
# (might take lighttpd 1 sec to detect backend exit)
|
||
|
select(undef, undef, undef, .9);
|
||
|
select(undef, undef, undef, .1) while (!$tf->listening_on(10000));
|
||
|
$t->{REQUEST} = ( <<EOF
|
||
|
GET /index.scgi?crlf HTTP/1.0
|
||
|
Host: www.example.org
|
||
|
EOF
|
||
|
);
|
||
|
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } ];
|
||
|
ok($tf->handle_http($t) == 0, 'regular response of after restart');
|
||
|
|
||
|
|
||
|
ok($tf->stop_proc == 0, "Stopping lighttpd");
|
||
|
}
|