3
# add current source dir to the include-path
4
# we need this for make distcheck
5
(my $srcdir = $0) =~ s#/[^/]+$#/#;
11
use Test::More tests => 9;
14
my $tf = LightyTest->new();
17
ok($tf->start_proc == 0, "Starting lighttpd") or die();
19
$t->{REQUEST} = ( <<EOF
20
GET /index.html HTTP/1.0
21
Accept-Encoding: deflate
24
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '' } ];
25
ok($tf->handle_http($t) == 0, 'Vary is set');
27
$t->{REQUEST} = ( <<EOF
28
GET /index.html HTTP/1.0
29
Accept-Encoding: deflate
30
Host: no-cache.example.org
33
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ];
34
ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set');
36
$t->{REQUEST} = ( <<EOF
37
GET /index.html HTTP/1.0
38
Accept-Encoding: deflate
39
Host: cache.example.org
42
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1288', '+Content-Encoding' => '' } ];
43
ok($tf->handle_http($t) == 0, 'deflate - Content-Length and Content-Encoding is set');
45
$t->{REQUEST} = ( <<EOF
46
GET /index.html HTTP/1.0
48
Host: no-cache.example.org
51
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ];
52
ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set');
54
$t->{REQUEST} = ( <<EOF
55
GET /index.html HTTP/1.0
57
Host: cache.example.org
60
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', 'Content-Length' => '1306', '+Content-Encoding' => '' } ];
61
ok($tf->handle_http($t) == 0, 'gzip - Content-Length and Content-Encoding is set');
64
$t->{REQUEST} = ( <<EOF
65
GET /index.txt HTTP/1.0
66
Accept-Encoding: gzip, deflate
69
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '' } ];
70
ok($tf->handle_http($t) == 0, 'gzip, deflate - Content-Length and Content-Encoding is set');
72
$t->{REQUEST} = ( <<EOF
73
GET /index.txt HTTP/1.0
74
Accept-Encoding: gzip, deflate
77
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '+Vary' => '', '+Content-Encoding' => '', 'Content-Type' => "text/plain" } ];
78
ok($tf->handle_http($t) == 0, 'Content-Type is from the original file');
80
ok($tf->stop_proc == 0, "Stopping lighttpd");