3 my $pre_chunked = ($ENV{"SERVER_SOFTWARE"} && index($ENV{"SERVER_SOFTWARE"}, "LightTPD") != -1);
5 sub print_maybe_chunked
12 printf "%lx\r\n", length($string);
16 print "Content-type: text/html\r\n";
18 print "Transfer-encoding: chunked\r\n";
25 print_maybe_chunked "<!DOCTYPE html><style>h2 { background-color: green; }</style>";
26 print_maybe_chunked "<link rel='stylesheet' onload='start()'>";
27 print_maybe_chunked "<body><script>document.getElementsByTagName('link')[0].href='resources/slow-loading-sheet.php?color=green&sleep=500000'; document.body.offsetTop; requestAnimationFrame(function() { console.log('requestAnimationFrame ran'); });";
28 print_maybe_chunked "function start() { console.log('Stylesheet loaded'); } console.log('Inline script done');</script>";
29 print_maybe_chunked "<h1>Styled by external stylesheet</h1><div style='height: 200px'></div><h2>Noncomposited</h2><h2 style='transform:translateZ(0)'>Composited</h2>";
31 print_maybe_chunked "";