[doc] NEWS
[lighttpd.git] / tests / request.t
blob96ef077b2f553f9c66321a426b929aa48d83f651
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;
9 use strict;
10 use IO::Socket;
11 use Test::More tests => 52;
12 use LightyTest;
14 my $tf = LightyTest->new();
15 my $t;
17 ok($tf->start_proc == 0, "Starting lighttpd") or die();
19 ## Basic Request-Handling
21 $t->{REQUEST} = ( <<EOF
22 GET /foobar HTTP/1.0
23 EOF
25 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
26 ok($tf->handle_http($t) == 0, 'file not found');
28 $t->{REQUEST} = ( <<EOF
29 GET /foobar?foobar HTTP/1.0
30 EOF
32 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
33 ok($tf->handle_http($t) == 0, 'file not found + querystring');
35 $t->{REQUEST} = ( <<EOF
36 GET /12345.txt HTTP/1.0
37 Host: 123.example.org
38 EOF
40 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ];
41 ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/plain');
43 $t->{REQUEST} = ( <<EOF
44 GET /12345.html HTTP/1.0
45 Host: 123.example.org
46 EOF
48 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/html' } ];
49 ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/html');
51 $t->{REQUEST} = ( <<EOF
52 GET /dummyfile.bla HTTP/1.0
53 Host: 123.example.org
54 EOF
56 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'application/octet-stream' } ];
57 ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype application/octet-stream');
60 $t->{REQUEST} = ( <<EOF
61 POST / HTTP/1.0
62 Content-type: application/x-www-form-urlencoded
63 Content-length: 0
64 EOF
66 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
67 ok($tf->handle_http($t) == 0, 'POST request, empty request-body');
69 $t->{REQUEST} = ( <<EOF
70 HEAD / HTTP/1.0
71 EOF
73 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => ''} ];
74 ok($tf->handle_http($t) == 0, 'HEAD request, no content');
76 $t->{REQUEST} = ( <<EOF
77 HEAD /12345.html HTTP/1.0
78 Host: 123.example.org
79 EOF
81 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
82 ok($tf->handle_http($t) == 0, 'HEAD request, mimetype text/html, content-length');
84 $t->{REQUEST} = ( <<EOF
85 HEAD http://123.example.org/12345.html HTTP/1.1
86 Connection: close
87 EOF
89 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
90 ok($tf->handle_http($t) == 0, 'Hostname in first line, HTTP/1.1');
92 $t->{REQUEST} = ( <<EOF
93 HEAD https://123.example.org/12345.html HTTP/1.0
94 EOF
96 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
97 ok($tf->handle_http($t) == 0, 'Hostname in first line as https url');
99 $t->{REQUEST} = ( <<EOF
100 HEAD /foobar?foobar HTTP/1.0
103 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, '-HTTP-Content' => '' } ];
104 ok($tf->handle_http($t) == 0, 'HEAD request, file-not-found, query-string');
106 # (expect 200 OK instead of 100 Continue since request body sent with request)
107 # (if we waited to send request body, would expect 100 Continue, first)
108 $t->{REQUEST} = ( <<EOF
109 POST /get-post-len.pl HTTP/1.1
110 Host: www.example.org
111 Connection: close
112 Content-Type: application/x-www-form-urlencoded
113 Content-Length: 4
114 Expect: 100-continue
119 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
120 ok($tf->handle_http($t) == 0, 'Continue, Expect');
122 # note Transfer-Encoding: chunked tests will fail with 411 Length Required if
123 # server.stream-request-body != 0 in lighttpd.conf
124 $t->{REQUEST} = ( <<EOF
125 POST /get-post-len.pl HTTP/1.1
126 Host: www.example.org
127 Connection: close
128 Content-Type: application/x-www-form-urlencoded
129 Transfer-Encoding: chunked
132 0123456789
137 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
138 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, lc hex');
140 $t->{REQUEST} = ( <<EOF
141 POST /get-post-len.pl HTTP/1.1
142 Host: www.example.org
143 Connection: close
144 Content-Type: application/x-www-form-urlencoded
145 Transfer-Encoding: chunked
148 0123456789
153 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
154 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, uc hex');
156 $t->{REQUEST} = ( <<EOF
157 POST /get-post-len.pl HTTP/1.1
158 Host: www.example.org
159 Connection: close
160 Content-Type: application/x-www-form-urlencoded
161 Transfer-Encoding: chunked
164 0123456789abcdef
169 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
170 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, two hex');
172 $t->{REQUEST} = ( <<EOF
173 POST /get-post-len.pl HTTP/1.1
174 Host: www.example.org
175 Connection: close
176 Content-Type: application/x-www-form-urlencoded
177 Transfer-Encoding: chunked
180 0123456789
182 Test-Trailer: testing
186 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
187 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, with trailer');
189 $t->{REQUEST} = ( <<EOF
190 POST /get-post-len.pl HTTP/1.1
191 Host: www.example.org
192 Connection: close
193 Content-Type: application/x-www-form-urlencoded
194 Transfer-Encoding: chunked
196 a; comment
197 0123456789
202 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
203 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, chunked header comment');
205 $t->{REQUEST} = ( <<EOF
206 POST /get-post-len.pl HTTP/1.1
207 Host: www.example.org
208 Connection: close
209 Content-Type: application/x-www-form-urlencoded
210 Transfer-Encoding: chunked
213 0123456789
218 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ];
219 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked; bad chunked header');
221 $t->{REQUEST} = ( <<EOF
222 POST /get-post-len.pl HTTP/1.1
223 Host: www.example.org
224 Connection: close
225 Content-Type: application/x-www-form-urlencoded
226 Transfer-Encoding: chunked
229 0123456789xxxxxxxx
234 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ];
235 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked; mismatch chunked header size and chunked data size');
237 $t->{REQUEST} = ( <<EOF
238 POST /get-post-len.pl HTTP/1.1
239 Host: www.example.org
240 Connection: close
241 Content-Type: application/x-www-form-urlencoded
242 Transfer-Encoding: chunked
244 a ; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
245 0123456789
250 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ];
251 ok($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked; chunked header too long');
253 ## ranges
255 $t->{REQUEST} = ( <<EOF
256 GET /12345.txt HTTP/1.0
257 Host: 123.example.org
258 Range: bytes=0-3
261 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '1234' } ];
262 ok($tf->handle_http($t) == 0, 'GET, Range 0-3');
264 $t->{REQUEST} = ( <<EOF
265 GET /12345.txt HTTP/1.0
266 Host: 123.example.org
267 Range: bytes=-3
270 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ];
271 ok($tf->handle_http($t) == 0, 'GET, Range -3');
273 $t->{REQUEST} = ( <<EOF
274 GET /12345.txt HTTP/1.0
275 Host: 123.example.org
276 Range: bytes=3-
279 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ];
280 ok($tf->handle_http($t) == 0, 'GET, Range 3-');
282 $t->{REQUEST} = ( <<EOF
283 GET /12345.txt HTTP/1.0
284 Host: 123.example.org
285 Range: bytes=0-1,3-4
288 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => <<EOF
290 --fkj49sn38dcn3\r
291 Content-Range: bytes 0-1/6\r
292 Content-Type: text/plain\r
294 12\r
295 --fkj49sn38dcn3\r
296 Content-Range: bytes 3-4/6\r
297 Content-Type: text/plain\r
299 45\r
300 --fkj49sn38dcn3--\r
302 } ];
303 ok($tf->handle_http($t) == 0, 'GET, Range 0-1,3-4');
305 $t->{REQUEST} = ( <<EOF
306 GET /12345.txt HTTP/1.0
307 Host: 123.example.org
308 Range: bytes=0--
311 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
312 ok($tf->handle_http($t) == 0, 'GET, Range 0--');
314 $t->{REQUEST} = ( <<EOF
315 GET /12345.txt HTTP/1.0
316 Host: 123.example.org
317 Range: bytes=-2-3
320 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
321 ok($tf->handle_http($t) == 0, 'GET, Range -2-3');
323 $t->{REQUEST} = ( <<EOF
324 GET /12345.txt HTTP/1.0
325 Host: 123.example.org
326 Range: bytes=-0
329 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF
330 <?xml version="1.0" encoding="iso-8859-1"?>
331 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
332 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
333 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
334 <head>
335 <title>416 Requested Range Not Satisfiable</title>
336 </head>
337 <body>
338 <h1>416 Requested Range Not Satisfiable</h1>
339 </body>
340 </html>
342 } ];
343 ok($tf->handle_http($t) == 0, 'GET, Range -0');
345 $t->{REQUEST} = ( <<EOF
346 GET /12345.txt HTTP/1.0
347 Host: 123.example.org
348 Range: bytes=25-
351 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF
352 <?xml version="1.0" encoding="iso-8859-1"?>
353 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
354 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
355 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
356 <head>
357 <title>416 Requested Range Not Satisfiable</title>
358 </head>
359 <body>
360 <h1>416 Requested Range Not Satisfiable</h1>
361 </body>
362 </html>
364 } ];
366 ok($tf->handle_http($t) == 0, 'GET, Range start out of range');
369 $t->{REQUEST} = ( <<EOF
370 GET / HTTP/1.0
371 Hsgfsdjf: asdfhdf
372 hdhd: shdfhfdasd
373 hfhr: jfghsdfg
374 jfuuehdmn: sfdgjfdg
375 jvcbzufdg: sgfdfg
376 hrnvcnd: jfjdfg
377 jfusfdngmd: gfjgfdusdfg
378 nfj: jgfdjdfg
379 jfue: jfdfdg
382 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
383 ok($tf->handle_http($t) == 0, 'larger headers');
386 $t->{REQUEST} = ( <<EOF
387 GET /range.pdf HTTP/1.0
388 Range: bytes=0-
391 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
392 ok($tf->handle_http($t) == 0, 'GET, Range with range-requests-disabled');
394 $t->{REQUEST} = ( <<EOF
395 GET /12345.txt HTTP/1.0
396 Host: 123.example.org
397 Range: 0
398 Range: bytes=0-3
401 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => "12345\n" } ];
402 ok($tf->handle_http($t) == 0, 'GET, Range invalid range-unit (first)');
404 $t->{REQUEST} = ( <<EOF
405 GET /12345.txt HTTP/1.0
406 Host: 123.example.org
407 Range: bytes=0-3
408 Range: 0
411 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206 } ];
412 ok($tf->handle_http($t) == 0, 'GET, Range ignore invalid range (second)');
414 $t->{REQUEST} = ( <<EOF
415 OPTIONS / HTTP/1.0
416 Content-Length: 4
418 1234
421 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
422 ok($tf->handle_http($t) == 0, 'OPTIONS with Content-Length');
424 $t->{REQUEST} = ( <<EOF
425 OPTIONS rtsp://221.192.134.146:80 RTSP/1.1
426 Host: 221.192.134.146:80
429 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
430 ok($tf->handle_http($t) == 0, 'OPTIONS for RTSP');
432 $t->{REQUEST} = ( <<EOF
433 GET /index.html HTTP/1.0
434 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
435 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
438 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
439 ok($tf->handle_http($t) == 0, 'Duplicate If-Mod-Since, with equal timestamps');
441 $t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \r\n\r\n" );
442 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
443 ok($tf->handle_http($t) == 0, 'empty If-Modified-Since');
445 $t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: foobar\r\n\r\n" );
446 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
447 ok($tf->handle_http($t) == 0, 'broken If-Modified-Since');
449 $t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: this string is too long to be a valid timestamp\r\n\r\n" );
450 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
451 ok($tf->handle_http($t) == 0, 'broken If-Modified-Since');
454 $t->{REQUEST} = ( <<EOF
455 GET /index.html HTTP/1.0
456 If-Modified-Since2: Sun, 01 Jan 2036 00:00:03 GMT
457 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
460 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
461 ok($tf->handle_http($t) == 0, 'Similar Headers (bug #1287)');
463 $t->{REQUEST} = ( <<EOF
464 GET /index.html HTTP/1.0
465 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
468 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, 'Content-Type' => 'text/html' } ];
469 ok($tf->handle_http($t) == 0, 'If-Modified-Since');
471 $t->{REQUEST} = ( <<EOF
472 GET /index.html HTTP/1.0
473 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
476 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, '-Content-Length' => '' } ];
477 ok($tf->handle_http($t) == 0, 'Status 304 has no Content-Length (#1002)');
479 $t->{REQUEST} = ( <<EOF
480 GET /12345.txt HTTP/1.0
481 Host: 123.example.org
484 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ];
485 $t->{SLOWREQUEST} = 1;
486 ok($tf->handle_http($t) == 0, 'GET, slow \\r\\n\\r\\n (#2105)');
487 undef $t->{SLOWREQUEST};
489 print "\nPathinfo for static files\n";
490 $t->{REQUEST} = ( <<EOF
491 GET /image.jpg/index.php HTTP/1.0
494 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ];
495 ok($tf->handle_http($t) == 0, 'static file accepting pathinfo by default');
497 $t->{REQUEST} = ( <<EOF
498 GET /image.jpg/index.php HTTP/1.0
499 Host: zzz.example.org
502 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
503 ok($tf->handle_http($t) == 0, 'static file with forbidden pathinfo');
506 print "\nConnection header\n";
507 $t->{REQUEST} = ( <<EOF
508 GET /12345.txt HTTP/1.1
509 Connection : close
510 Host: 123.example.org
513 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
514 ok($tf->handle_http($t) == 0, 'Connection-header, spaces before ":"');
516 $t->{REQUEST} = ( <<EOF
517 GET /12345.txt HTTP/1.1
518 Connection: ,close
519 Host: 123.example.org
522 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
523 ok($tf->handle_http($t) == 0, 'Connection-header, leading comma');
525 $t->{REQUEST} = ( <<EOF
526 GET /12345.txt HTTP/1.1
527 Connection: close,,TE
528 Host: 123.example.org
531 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
532 ok($tf->handle_http($t) == 0, 'Connection-header, no value between two commas');
534 $t->{REQUEST} = ( <<EOF
535 GET /12345.txt HTTP/1.1
536 Connection: close, ,TE
537 Host: 123.example.org
540 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
541 ok($tf->handle_http($t) == 0, 'Connection-header, space between two commas');
543 $t->{REQUEST} = ( <<EOF
544 GET /12345.txt HTTP/1.1
545 Connection: close,
546 Host: 123.example.org
549 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
550 ok($tf->handle_http($t) == 0, 'Connection-header, comma after value');
552 $t->{REQUEST} = ( <<EOF
553 GET /12345.txt HTTP/1.1
554 Connection: close,
555 Host: 123.example.org
558 $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
559 ok($tf->handle_http($t) == 0, 'Connection-header, comma and space after value');
561 ok($tf->stop_proc == 0, "Stopping lighttpd");