request.t 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  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. use strict;
  9. use IO::Socket;
  10. use Test::More tests => 52;
  11. use LightyTest;
  12. my $tf = LightyTest->new();
  13. my $t;
  14. ok($tf->start_proc == 0, "Starting lighttpd") or die();
  15. ## Basic Request-Handling
  16. $t->{REQUEST} = ( <<EOF
  17. GET /foobar HTTP/1.0
  18. EOF
  19. );
  20. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
  21. ok($tf->handle_http($t) == 0, 'file not found');
  22. $t->{REQUEST} = ( <<EOF
  23. GET /foobar?foobar HTTP/1.0
  24. EOF
  25. );
  26. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
  27. ok($tf->handle_http($t) == 0, 'file not found + querystring');
  28. $t->{REQUEST} = ( <<EOF
  29. GET /12345.txt HTTP/1.0
  30. Host: 123.example.org
  31. EOF
  32. );
  33. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ];
  34. ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/plain');
  35. $t->{REQUEST} = ( <<EOF
  36. GET /12345.html HTTP/1.0
  37. Host: 123.example.org
  38. EOF
  39. );
  40. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/html' } ];
  41. ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype text/html');
  42. $t->{REQUEST} = ( <<EOF
  43. GET /dummyfile.bla HTTP/1.0
  44. Host: 123.example.org
  45. EOF
  46. );
  47. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'application/octet-stream' } ];
  48. ok($tf->handle_http($t) == 0, 'GET, content == 12345, mimetype application/octet-stream');
  49. $t->{REQUEST} = ( <<EOF
  50. POST / HTTP/1.0
  51. EOF
  52. );
  53. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 411 } ];
  54. ok($tf->handle_http($t) == 0, 'POST request, no Content-Length');
  55. $t->{REQUEST} = ( <<EOF
  56. POST / HTTP/1.0
  57. Content-type: application/x-www-form-urlencoded
  58. Content-length: 0
  59. EOF
  60. );
  61. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  62. ok($tf->handle_http($t) == 0, 'POST request, empty request-body');
  63. $t->{REQUEST} = ( <<EOF
  64. HEAD / HTTP/1.0
  65. EOF
  66. );
  67. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => ''} ];
  68. ok($tf->handle_http($t) == 0, 'HEAD request, no content');
  69. $t->{REQUEST} = ( <<EOF
  70. HEAD /12345.html HTTP/1.0
  71. Host: 123.example.org
  72. EOF
  73. );
  74. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
  75. ok($tf->handle_http($t) == 0, 'HEAD request, mimetype text/html, content-length');
  76. $t->{REQUEST} = ( <<EOF
  77. HEAD http://123.example.org/12345.html HTTP/1.1
  78. Connection: close
  79. EOF
  80. );
  81. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
  82. ok($tf->handle_http($t) == 0, 'Hostname in first line, HTTP/1.1');
  83. $t->{REQUEST} = ( <<EOF
  84. HEAD https://123.example.org/12345.html HTTP/1.0
  85. EOF
  86. );
  87. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, '-HTTP-Content' => '', 'Content-Type' => 'text/html', 'Content-Length' => '6'} ];
  88. ok($tf->handle_http($t) == 0, 'Hostname in first line as https url');
  89. $t->{REQUEST} = ( <<EOF
  90. HEAD /foobar?foobar HTTP/1.0
  91. EOF
  92. );
  93. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404, '-HTTP-Content' => '' } ];
  94. ok($tf->handle_http($t) == 0, 'HEAD request, file-not-found, query-string');
  95. $t->{REQUEST} = ( <<EOF
  96. GET / HTTP/1.1
  97. Connection: close
  98. Expect: 100-continue
  99. EOF
  100. );
  101. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 417 } ];
  102. ok($tf->handle_http($t) == 0, 'Continue, Expect');
  103. ## ranges
  104. $t->{REQUEST} = ( <<EOF
  105. GET /12345.txt HTTP/1.0
  106. Host: 123.example.org
  107. Range: bytes=0-3
  108. EOF
  109. );
  110. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '1234' } ];
  111. ok($tf->handle_http($t) == 0, 'GET, Range 0-3');
  112. $t->{REQUEST} = ( <<EOF
  113. GET /12345.txt HTTP/1.0
  114. Host: 123.example.org
  115. Range: bytes=-3
  116. EOF
  117. );
  118. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ];
  119. ok($tf->handle_http($t) == 0, 'GET, Range -3');
  120. $t->{REQUEST} = ( <<EOF
  121. GET /12345.txt HTTP/1.0
  122. Host: 123.example.org
  123. Range: bytes=3-
  124. EOF
  125. );
  126. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => '45'."\n" } ];
  127. ok($tf->handle_http($t) == 0, 'GET, Range 3-');
  128. $t->{REQUEST} = ( <<EOF
  129. GET /12345.txt HTTP/1.0
  130. Host: 123.example.org
  131. Range: bytes=0-1,3-4
  132. EOF
  133. );
  134. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 206, 'HTTP-Content' => <<EOF
  135. \r
  136. --fkj49sn38dcn3\r
  137. Content-Range: bytes 0-1/6\r
  138. Content-Type: text/plain\r
  139. \r
  140. 12\r
  141. --fkj49sn38dcn3\r
  142. Content-Range: bytes 3-4/6\r
  143. Content-Type: text/plain\r
  144. \r
  145. 45\r
  146. --fkj49sn38dcn3--\r
  147. EOF
  148. } ];
  149. ok($tf->handle_http($t) == 0, 'GET, Range 0-1,3-4');
  150. $t->{REQUEST} = ( <<EOF
  151. GET /12345.txt HTTP/1.0
  152. Host: 123.example.org
  153. Range: bytes=0--
  154. EOF
  155. );
  156. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  157. ok($tf->handle_http($t) == 0, 'GET, Range 0--');
  158. $t->{REQUEST} = ( <<EOF
  159. GET /12345.txt HTTP/1.0
  160. Host: 123.example.org
  161. Range: bytes=-2-3
  162. EOF
  163. );
  164. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  165. ok($tf->handle_http($t) == 0, 'GET, Range -2-3');
  166. $t->{REQUEST} = ( <<EOF
  167. GET /12345.txt HTTP/1.0
  168. Host: 123.example.org
  169. Range: bytes=-0
  170. EOF
  171. );
  172. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF
  173. <?xml version="1.0" encoding="iso-8859-1"?>
  174. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  175. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  176. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  177. <head>
  178. <title>416 - Requested Range Not Satisfiable</title>
  179. </head>
  180. <body>
  181. <h1>416 - Requested Range Not Satisfiable</h1>
  182. </body>
  183. </html>
  184. EOF
  185. } ];
  186. ok($tf->handle_http($t) == 0, 'GET, Range -0');
  187. $t->{REQUEST} = ( <<EOF
  188. GET /12345.txt HTTP/1.0
  189. Host: 123.example.org
  190. Range: bytes=25-
  191. EOF
  192. );
  193. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 416, 'HTTP-Content' => <<EOF
  194. <?xml version="1.0" encoding="iso-8859-1"?>
  195. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  196. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  197. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  198. <head>
  199. <title>416 - Requested Range Not Satisfiable</title>
  200. </head>
  201. <body>
  202. <h1>416 - Requested Range Not Satisfiable</h1>
  203. </body>
  204. </html>
  205. EOF
  206. } ];
  207. ok($tf->handle_http($t) == 0, 'GET, Range start out of range');
  208. $t->{REQUEST} = ( <<EOF
  209. GET / HTTP/1.0
  210. Hsgfsdjf: asdfhdf
  211. hdhd: shdfhfdasd
  212. hfhr: jfghsdfg
  213. jfuuehdmn: sfdgjfdg
  214. jvcbzufdg: sgfdfg
  215. hrnvcnd: jfjdfg
  216. jfusfdngmd: gfjgfdusdfg
  217. nfj: jgfdjdfg
  218. jfue: jfdfdg
  219. EOF
  220. );
  221. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  222. ok($tf->handle_http($t) == 0, 'larger headers');
  223. $t->{REQUEST} = ( <<EOF
  224. GET / HTTP/1.0
  225. Host: www.example.org
  226. Host: 123.example.org
  227. EOF
  228. );
  229. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  230. ok($tf->handle_http($t) == 0, 'Duplicate Host headers, Bug #25');
  231. $t->{REQUEST} = ( <<EOF
  232. GET / HTTP/1.0
  233. Content-Length: 5
  234. Content-Length: 4
  235. EOF
  236. );
  237. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  238. ok($tf->handle_http($t) == 0, 'Duplicate Content-Length headers');
  239. $t->{REQUEST} = ( <<EOF
  240. GET / HTTP/1.0
  241. Content-Type: 5
  242. Content-Type: 4
  243. EOF
  244. );
  245. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  246. ok($tf->handle_http($t) == 0, 'Duplicate Content-Type headers');
  247. $t->{REQUEST} = ( <<EOF
  248. GET / HTTP/1.0
  249. Range: bytes=5-6
  250. Range: bytes=5-9
  251. EOF
  252. );
  253. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  254. ok($tf->handle_http($t) == 0, 'Duplicate Range headers');
  255. $t->{REQUEST} = ( <<EOF
  256. GET / HTTP/1.0
  257. If-None-Match: 5
  258. If-None-Match: 4
  259. EOF
  260. );
  261. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  262. ok($tf->handle_http($t) == 0, 'Duplicate If-None-Match headers');
  263. $t->{REQUEST} = ( <<EOF
  264. GET / HTTP/1.0
  265. If-Modified-Since: 5
  266. If-Modified-Since: 4
  267. EOF
  268. );
  269. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  270. ok($tf->handle_http($t) == 0, 'Duplicate If-Modified-Since headers');
  271. $t->{REQUEST} = ( <<EOF
  272. GET /range.pdf HTTP/1.0
  273. Range: bytes=0-
  274. EOF
  275. );
  276. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  277. ok($tf->handle_http($t) == 0, 'GET, Range with range-requests-disabled');
  278. $t->{REQUEST} = ( <<EOF
  279. GET / HTTP/1.0
  280. Content-Length: 4
  281. 1234
  282. EOF
  283. );
  284. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  285. ok($tf->handle_http($t) == 0, 'GET with Content-Length');
  286. $t->{REQUEST} = ( <<EOF
  287. OPTIONS / HTTP/1.0
  288. Content-Length: 4
  289. 1234
  290. EOF
  291. );
  292. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  293. ok($tf->handle_http($t) == 0, 'OPTIONS with Content-Length');
  294. $t->{REQUEST} = ( <<EOF
  295. OPTIONS rtsp://221.192.134.146:80 RTSP/1.1
  296. Host: 221.192.134.146:80
  297. EOF
  298. );
  299. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  300. ok($tf->handle_http($t) == 0, 'OPTIONS for RTSP');
  301. $t->{REQUEST} = ( <<EOF
  302. HEAD / HTTP/1.0
  303. Content-Length: 4
  304. 1234
  305. EOF
  306. );
  307. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  308. ok($tf->handle_http($t) == 0, 'HEAD with Content-Length');
  309. $t->{REQUEST} = ( <<EOF
  310. GET /index.html HTTP/1.0
  311. If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
  312. If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
  313. EOF
  314. );
  315. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
  316. ok($tf->handle_http($t) == 0, 'Duplicate If-Mod-Since, with equal timestamps');
  317. $t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \0\r\n\r\n" );
  318. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 400 } ];
  319. ok($tf->handle_http($t) == 0, 'invalid chars in Header values (bug #1286)');
  320. $t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: \r\n\r\n" );
  321. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  322. ok($tf->handle_http($t) == 0, 'empty If-Modified-Since');
  323. $t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: foobar\r\n\r\n" );
  324. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  325. ok($tf->handle_http($t) == 0, 'broken If-Modified-Since');
  326. $t->{REQUEST} = ( "GET / HTTP/1.0\r\nIf-Modified-Since: this string is too long to be a valid timestamp\r\n\r\n" );
  327. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
  328. ok($tf->handle_http($t) == 0, 'broken If-Modified-Since');
  329. $t->{REQUEST} = ( <<EOF
  330. GET /index.html HTTP/1.0
  331. If-Modified-Since2: Sun, 01 Jan 2036 00:00:03 GMT
  332. If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
  333. EOF
  334. );
  335. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304 } ];
  336. ok($tf->handle_http($t) == 0, 'Similar Headers (bug #1287)');
  337. $t->{REQUEST} = ( <<EOF
  338. GET /index.html HTTP/1.0
  339. If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
  340. EOF
  341. );
  342. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, 'Content-Type' => 'text/html' } ];
  343. ok($tf->handle_http($t) == 0, 'If-Modified-Since');
  344. $t->{REQUEST} = ( <<EOF
  345. GET /index.html HTTP/1.0
  346. If-Modified-Since: Sun, 01 Jan 2036 00:00:02 GMT
  347. EOF
  348. );
  349. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 304, '-Content-Length' => '' } ];
  350. ok($tf->handle_http($t) == 0, 'Status 304 has no Content-Length (#1002)');
  351. $t->{REQUEST} = ( <<EOF
  352. GET /12345.txt HTTP/1.0
  353. Host: 123.example.org
  354. EOF
  355. );
  356. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain' } ];
  357. $t->{SLOWREQUEST} = 1;
  358. ok($tf->handle_http($t) == 0, 'GET, slow \\r\\n\\r\\n (#2105)');
  359. print "\nPathinfo for static files\n";
  360. $t->{REQUEST} = ( <<EOF
  361. GET /image.jpg/index.php HTTP/1.0
  362. EOF
  363. );
  364. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'Content-Type' => 'image/jpeg' } ];
  365. ok($tf->handle_http($t) == 0, 'static file accepting pathinfo by default');
  366. $t->{REQUEST} = ( <<EOF
  367. GET /image.jpg/index.php HTTP/1.0
  368. Host: zzz.example.org
  369. EOF
  370. );
  371. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 403 } ];
  372. ok($tf->handle_http($t) == 0, 'static file with forbidden pathinfo');
  373. print "\nConnection header\n";
  374. $t->{REQUEST} = ( <<EOF
  375. GET /12345.txt HTTP/1.1
  376. Connection : close
  377. Host: 123.example.org
  378. EOF
  379. );
  380. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
  381. ok($tf->handle_http($t) == 0, 'Connection-header, spaces before ":"');
  382. $t->{REQUEST} = ( <<EOF
  383. GET /12345.txt HTTP/1.1
  384. Connection: ,close
  385. Host: 123.example.org
  386. EOF
  387. );
  388. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
  389. ok($tf->handle_http($t) == 0, 'Connection-header, leading comma');
  390. $t->{REQUEST} = ( <<EOF
  391. GET /12345.txt HTTP/1.1
  392. Connection: close,,TE
  393. Host: 123.example.org
  394. EOF
  395. );
  396. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
  397. ok($tf->handle_http($t) == 0, 'Connection-header, no value between two commas');
  398. $t->{REQUEST} = ( <<EOF
  399. GET /12345.txt HTTP/1.1
  400. Connection: close, ,TE
  401. Host: 123.example.org
  402. EOF
  403. );
  404. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
  405. ok($tf->handle_http($t) == 0, 'Connection-header, space between two commas');
  406. $t->{REQUEST} = ( <<EOF
  407. GET /12345.txt HTTP/1.1
  408. Connection: close,
  409. Host: 123.example.org
  410. EOF
  411. );
  412. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
  413. ok($tf->handle_http($t) == 0, 'Connection-header, comma after value');
  414. $t->{REQUEST} = ( <<EOF
  415. GET /12345.txt HTTP/1.1
  416. Connection: close,
  417. Host: 123.example.org
  418. EOF
  419. );
  420. $t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.1', 'HTTP-Status' => 200, 'HTTP-Content' => '12345'."\n", 'Content-Type' => 'text/plain', 'Connection' => 'close' } ];
  421. ok($tf->handle_http($t) == 0, 'Connection-header, comma and space after value');
  422. ok($tf->stop_proc == 0, "Stopping lighttpd");