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
=> 59;
14 my $tf = LightyTest
->new();
17 ok
($tf->start_proc == 0, "Starting lighttpd") or die();
19 ## Basic Request-Handling
21 $t->{REQUEST
} = ( <<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
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
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
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
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');
59 $t->{REQUEST
} = ( <<EOF
63 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ];
64 ok
($tf->handle_http($t) == 0, 'POST request, no Content-Length');
67 $t->{REQUEST
} = ( <<EOF
69 Content-type: application/x-www-form-urlencoded
73 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
74 ok
($tf->handle_http($t) == 0, 'POST request, empty request-body');
76 $t->{REQUEST
} = ( <<EOF
80 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => ''} ];
81 ok
($tf->handle_http($t) == 0, 'HEAD request, no content');
83 $t->{REQUEST
} = ( <<EOF
84 HEAD /12345.html HTTP/1.0
88 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
89 ok
($tf->handle_http($t) == 0, 'HEAD request, mimetype text/html, content-length');
91 $t->{REQUEST
} = ( <<EOF
92 HEAD http://123.example.org/12345.html HTTP/1.1
96 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
97 ok
($tf->handle_http($t) == 0, 'Hostname in first line, HTTP/1.1');
99 $t->{REQUEST
} = ( <<EOF
100 HEAD https://123.example.org/12345.html HTTP/1.0
103 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
104 ok
($tf->handle_http($t) == 0, 'Hostname in first line as https url');
106 $t->{REQUEST
} = ( <<EOF
107 HEAD /foobar?foobar HTTP/1.0
110 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, '-HTTP-Content' => '' } ];
111 ok
($tf->handle_http($t) == 0, 'HEAD request, file-not-found, query-string');
113 # (expect 200 OK instead of 100 Continue since request body sent with request)
114 # (if we waited to send request body, would expect 100 Continue, first)
115 $t->{REQUEST
} = ( <<EOF
116 POST /get-post-len.pl HTTP/1.1
117 Host: www.example.org
119 Content-Type: application/x-www-form-urlencoded
126 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
127 ok
($tf->handle_http($t) == 0, 'Continue, Expect');
129 # note Transfer-Encoding: chunked tests will fail with 411 Length Required if
130 # server.stream-request-body != 0 in lighttpd.conf
131 $t->{REQUEST
} = ( <<EOF
132 POST /get-post-len.pl HTTP/1.1
133 Host: www.example.org
135 Content-Type: application/x-www-form-urlencoded
136 Transfer-Encoding: chunked
144 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
145 ok
($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, lc hex');
147 $t->{REQUEST
} = ( <<EOF
148 POST /get-post-len.pl HTTP/1.1
149 Host: www.example.org
151 Content-Type: application/x-www-form-urlencoded
152 Transfer-Encoding: chunked
160 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
161 ok
($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, uc hex');
163 $t->{REQUEST
} = ( <<EOF
164 POST /get-post-len.pl HTTP/1.1
165 Host: www.example.org
167 Content-Type: application/x-www-form-urlencoded
168 Transfer-Encoding: chunked
173 Test-Trailer: testing
177 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
178 ok
($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, with trailer');
180 $t->{REQUEST
} = ( <<EOF
181 POST /get-post-len.pl HTTP/1.1
182 Host: www.example.org
184 Content-Type: application/x-www-form-urlencoded
185 Transfer-Encoding: chunked
193 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200 } ];
194 ok
($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked, chunked header comment');
196 $t->{REQUEST
} = ( <<EOF
197 POST /get-post-len.pl HTTP/1.1
198 Host: www.example.org
200 Content-Type: application/x-www-form-urlencoded
201 Transfer-Encoding: chunked
209 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ];
210 ok
($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked; bad chunked header');
212 $t->{REQUEST
} = ( <<EOF
213 POST /get-post-len.pl HTTP/1.1
214 Host: www.example.org
216 Content-Type: application/x-www-form-urlencoded
217 Transfer-Encoding: chunked
225 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ];
226 ok
($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked; mismatch chunked header size and chunked data size');
228 $t->{REQUEST
} = ( <<EOF
229 POST /get-post-len.pl HTTP/1.1
230 Host: www.example.org
232 Content-Type: application/x-www-form-urlencoded
233 Transfer-Encoding: chunked
235 a ; xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
241 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 400 } ];
242 ok
($tf->handle_http($t) == 0, 'POST via Transfer-Encoding: chunked; chunked header too long');
246 $t->{REQUEST
} = ( <<EOF
247 GET /12345.txt HTTP/1.0
248 Host: 123.example.org
252 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '1234' } ];
253 ok
($tf->handle_http($t) == 0, 'GET, Range 0-3');
255 $t->{REQUEST
} = ( <<EOF
256 GET /12345.txt HTTP/1.0
257 Host: 123.example.org
261 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ];
262 ok
($tf->handle_http($t) == 0, 'GET, Range -3');
264 $t->{REQUEST
} = ( <<EOF
265 GET /12345.txt HTTP/1.0
266 Host: 123.example.org
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
279 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => <<EOF
282 Content-Range: bytes 0-1/6\r
283 Content-Type: text/plain\r
287 Content-Range: bytes 3-4/6\r
288 Content-Type: text/plain\r
294 ok
($tf->handle_http($t) == 0, 'GET, Range 0-1,3-4');
296 $t->{REQUEST
} = ( <<EOF
297 GET /12345.txt HTTP/1.0
298 Host: 123.example.org
302 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
303 ok
($tf->handle_http($t) == 0, 'GET, Range 0--');
305 $t->{REQUEST
} = ( <<EOF
306 GET /12345.txt HTTP/1.0
307 Host: 123.example.org
311 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
312 ok
($tf->handle_http($t) == 0, 'GET, Range -2-3');
314 $t->{REQUEST
} = ( <<EOF
315 GET /12345.txt HTTP/1.0
316 Host: 123.example.org
320 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF
321 <?xml version="1.0" encoding="iso-8859-1"?>
322 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
323 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
324 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
326 <title>416 - Requested Range Not Satisfiable</title>
329 <h1>416 - Requested Range Not Satisfiable</h1>
334 ok
($tf->handle_http($t) == 0, 'GET, Range -0');
336 $t->{REQUEST
} = ( <<EOF
337 GET /12345.txt HTTP/1.0
338 Host: 123.example.org
342 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF
343 <?xml version="1.0" encoding="iso-8859-1"?>
344 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
345 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
346 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
348 <title>416 - Requested Range Not Satisfiable</title>
351 <h1>416 - Requested Range Not Satisfiable</h1>
357 ok
($tf->handle_http($t) == 0, 'GET, Range start out of range');
360 $t->{REQUEST
} = ( <<EOF
368 jfusfdngmd: gfjgfdusdfg
373 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
374 ok
($tf->handle_http($t) == 0, 'larger headers');
377 $t->{REQUEST
} = ( <<EOF
379 Host: www.example.org
380 Host: 123.example.org
383 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
384 ok
($tf->handle_http($t) == 0, 'Duplicate Host headers, Bug #25');
387 $t->{REQUEST
} = ( <<EOF
393 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
394 ok
($tf->handle_http($t) == 0, 'Duplicate Content-Length headers');
396 $t->{REQUEST
} = ( <<EOF
402 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
403 ok
($tf->handle_http($t) == 0, 'Duplicate Content-Type headers');
405 $t->{REQUEST
} = ( <<EOF
411 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
412 ok
($tf->handle_http($t) == 0, 'Duplicate Range headers');
414 $t->{REQUEST
} = ( <<EOF
420 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
421 ok
($tf->handle_http($t) == 0, 'Duplicate If-None-Match headers');
423 $t->{REQUEST
} = ( <<EOF
429 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
430 ok
($tf->handle_http($t) == 0, 'Duplicate If-Modified-Since headers');
432 $t->{REQUEST
} = ( <<EOF
433 GET /range.pdf HTTP/1.0
437 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
438 ok
($tf->handle_http($t) == 0, 'GET, Range with range-requests-disabled');
440 $t->{REQUEST
} = ( <<EOF
447 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
448 ok
($tf->handle_http($t) == 0, 'GET with Content-Length');
450 $t->{REQUEST
} = ( <<EOF
457 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
458 ok
($tf->handle_http($t) == 0, 'OPTIONS with Content-Length');
460 $t->{REQUEST
} = ( <<EOF
461 OPTIONS rtsp://221.192.134.146:80 RTSP/1.1
462 Host: 221.192.134.146:80
465 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
466 ok
($tf->handle_http($t) == 0, 'OPTIONS for RTSP');
468 $t->{REQUEST
} = ( <<EOF
475 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
476 ok
($tf->handle_http($t) == 0, 'HEAD with Content-Length');
478 $t->{REQUEST
} = ( <<EOF
479 GET /index.html HTTP/1.0
480 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
481 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
484 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
485 ok
($tf->handle_http($t) == 0, 'Duplicate If-Mod-Since, with equal timestamps');
487 $t->{REQUEST
} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \0\r\n\r\n" );
488 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
489 ok
($tf->handle_http($t) == 0, 'invalid chars in Header values (bug #1286)');
491 $t->{REQUEST
} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \r\n\r\n" );
492 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
493 ok
($tf->handle_http($t) == 0, 'empty If-Modified-Since');
495 $t->{REQUEST
} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: foobar\r\n\r\n" );
496 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
497 ok
($tf->handle_http($t) == 0, 'broken If-Modified-Since');
499 $t->{REQUEST
} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: this string is too long to be a valid timestamp\r\n\r\n" );
500 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
501 ok
($tf->handle_http($t) == 0, 'broken If-Modified-Since');
504 $t->{REQUEST
} = ( <<EOF
505 GET /index.html HTTP/1.0
506 If-Modified-Since2: Sun, 01 Jan 2036 00:00:03 GMT
507 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
510 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
511 ok
($tf->handle_http($t) == 0, 'Similar Headers (bug #1287)');
513 $t->{REQUEST
} = ( <<EOF
514 GET /index.html HTTP/1.0
515 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
518 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, 'Content-Type' => 'text/html' } ];
519 ok
($tf->handle_http($t) == 0, 'If-Modified-Since');
521 $t->{REQUEST
} = ( <<EOF
522 GET /index.html HTTP/1.0
523 If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
526 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, '-Content-Length' => '' } ];
527 ok
($tf->handle_http($t) == 0, 'Status 304 has no Content-Length (#1002)');
529 $t->{REQUEST
} = ( <<EOF
530 GET /12345.txt HTTP/1.0
531 Host: 123.example.org
534 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ];
535 $t->{SLOWREQUEST
} = 1;
536 ok
($tf->handle_http($t) == 0, 'GET, slow \\r\\n\\r\\n (#2105)');
537 undef $t->{SLOWREQUEST
};
539 print "\nPathinfo for static files\n";
540 $t->{REQUEST
} = ( <<EOF
541 GET /image.jpg/index.php HTTP/1.0
544 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ];
545 ok
($tf->handle_http($t) == 0, 'static file accepting pathinfo by default');
547 $t->{REQUEST
} = ( <<EOF
548 GET /image.jpg/index.php HTTP/1.0
549 Host: zzz.example.org
552 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
553 ok
($tf->handle_http($t) == 0, 'static file with forbidden pathinfo');
556 print "\nConnection header\n";
557 $t->{REQUEST
} = ( <<EOF
558 GET /12345.txt HTTP/1.1
560 Host: 123.example.org
563 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
564 ok
($tf->handle_http($t) == 0, 'Connection-header, spaces before ":"');
566 $t->{REQUEST
} = ( <<EOF
567 GET /12345.txt HTTP/1.1
569 Host: 123.example.org
572 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
573 ok
($tf->handle_http($t) == 0, 'Connection-header, leading comma');
575 $t->{REQUEST
} = ( <<EOF
576 GET /12345.txt HTTP/1.1
577 Connection: close,,TE
578 Host: 123.example.org
581 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
582 ok
($tf->handle_http($t) == 0, 'Connection-header, no value between two commas');
584 $t->{REQUEST
} = ( <<EOF
585 GET /12345.txt HTTP/1.1
586 Connection: close, ,TE
587 Host: 123.example.org
590 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
591 ok
($tf->handle_http($t) == 0, 'Connection-header, space between two commas');
593 $t->{REQUEST
} = ( <<EOF
594 GET /12345.txt HTTP/1.1
596 Host: 123.example.org
599 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
600 ok
($tf->handle_http($t) == 0, 'Connection-header, comma after value');
602 $t->{REQUEST
} = ( <<EOF
603 GET /12345.txt HTTP/1.1
605 Host: 123.example.org
608 $t->{RESPONSE
} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
609 ok
($tf->handle_http($t) == 0, 'Connection-header, comma and space after value');
611 ok
($tf->stop_proc == 0, "Stopping lighttpd");