Annotation of embedaddon/lighttpd/tests/core-keepalive.t, revision 1.1.1.1
1.1 misho 1: #!/usr/bin/env perl
2: BEGIN {
3: # add current source dir to the include-path
4: # we need this for make distcheck
5: (my $srcdir = $0) =~ s,/[^/]+$,/,;
6: unshift @INC, $srcdir;
7: }
8:
9: use strict;
10: use IO::Socket;
11: use Test::More tests => 7;
12: use LightyTest;
13:
14: my $tf = LightyTest->new();
15: my $t;
16:
17: ok($tf->start_proc == 0, "Starting lighttpd") or die();
18:
19: $t->{REQUEST} = ( <<EOF
20: GET /12345.txt HTTP/1.0
21: Connection: keep-alive
22: Host: 123.example.org
23:
24: GET /12345.txt HTTP/1.0
25: Host: 123.example.org
26: Connection: close
27: EOF
28: );
29: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
30:
31: ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.0 Keep-Alive');
32:
33: undef $t->{RESPONSE};
34:
35: $t->{REQUEST} = ( <<EOF
36: GET /12345.txt HTTP/1.0
37: Connection: keep-alive
38: Host: 123.example.org
39:
40: GET /12345.txt HTTP/1.0
41: Host: 123.example.org
42: Connection: close
43: EOF
44: );
45: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
46:
47: ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.0 Keep-Alive');
48:
49: undef $t->{RESPONSE};
50:
51: $t->{REQUEST} = ( <<EOF
52: GET /12345.txt HTTP/1.0
53: Connection: keep-alive
54: Host: 123.example.org
55:
56: GET /12345.txt HTTP/1.0
57: Host: 123.example.org
58: EOF
59: );
60: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
61: ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.0 Keep-Alive');
62:
63:
64: $t->{REQUEST} = ( <<EOF
65: GET /12345.txt HTTP/1.1
66: Connection: keep-alive
67: Host: 123.example.org
68:
69: GET /12345.txt HTTP/1.1
70: Host: 123.example.org
71: Connection: close
72: EOF
73: );
74: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
75: ok($tf->handle_http($t) == 0, 'Explicit HTTP/1.1 Keep-Alive');
76:
77: $t->{REQUEST} = ( <<EOF
78: GET /12345.txt HTTP/1.1
79: Host: 123.example.org
80:
81: GET /12345.txt HTTP/1.1
82: Host: 123.example.org
83: Connection: close
84: EOF
85: );
86:
87: $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } , { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
88:
89: ok($tf->handle_http($t) == 0, 'Implicit HTTP/1.1 Keep-Alive');
90:
91: ok($tf->stop_proc == 0, "Stopping lighttpd");
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>