comparison proxy-noclose.t @ 29:71ea39729fa0

Tests: memcached module generic tests. This also includes relevant framework improvements, notably the ability to test presence of external daemons and to run them.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 11 Oct 2008 10:58:43 +0400
parents fbda19df2fc4
children 7bf0e8a1d66c
comparison
equal deleted inserted replaced
28:8f1519472ece 29:71ea39729fa0
75 ############################################################################### 75 ###############################################################################
76 76
77 TODO: { 77 TODO: {
78 local $TODO = 'not fixed yet, patches under review'; 78 local $TODO = 'not fixed yet, patches under review';
79 79
80 like(http_request('/'), qr/SEE-THIS/, 'request to bad backend'); 80 like(http_get('/'), qr/SEE-THIS/, 'request to bad backend');
81 like(http_request('/multi'), qr/AND-THIS/, 'bad backend - multiple packets'); 81 like(http_get('/multi'), qr/AND-THIS/, 'bad backend - multiple packets');
82 like(http_request('/nolen'), qr/SEE-THIS/, 'bad backend - no content length'); 82 like(http_get('/nolen'), qr/SEE-THIS/, 'bad backend - no content length');
83 like(http_request('/uselen'), qr/SEE-THIS/, 'content-length actually used'); 83 like(http_get('/uselen'), qr/SEE-THIS/, 'content-length actually used');
84 84
85 } 85 }
86 86
87 ############################################################################### 87 ###############################################################################
88
89 sub http_request {
90 my ($url) = @_;
91 my $r = http(<<EOF);
92 GET $url HTTP/1.1
93 Host: localhost
94 Connection: close
95
96 EOF
97 }
98 88
99 sub http_noclose_daemon { 89 sub http_noclose_daemon {
100 my $server = IO::Socket::INET->new( 90 my $server = IO::Socket::INET->new(
101 Proto => 'tcp', 91 Proto => 'tcp',
102 LocalPort => 8081, 92 LocalPort => 8081,