]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Minify/extlib/minify/min_unit_tests/HTTP_ConditionalGet/_include.php
Added minify plugin
[quix0rs-gnu-social.git] / plugins / Minify / extlib / minify / min_unit_tests / HTTP_ConditionalGet / _include.php
1 <?php
2
3 function send_slowly($content)
4 {
5     $half = ceil(strlen($content) / 2);
6     $content = str_split($content, $half);
7     while ($chunk = array_shift($content)) {
8         sleep(1);
9         echo $chunk;
10         ob_get_level() && ob_flush();
11         flush();
12     }
13 }
14
15 function get_content($data)
16 {
17     ob_start();
18 ?>
19 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
20 <html>
21 <head>
22 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
23 <title>HTTP_ConditionalGet : <?php echo $data['title']; ?></title>
24 </head>
25 <body>
26 <h1>HTTP_ConditionalGet</h1>
27 <h2><?php echo $data['title']; ?></h2>
28 <?php echo $data['explain']; ?>
29 <ul>
30         <li><a href="./">Last-Modified is known : simple usage</a></li>
31         <li><a href="2.php">Last-Modified is known : add Content-Length</a></li>
32         <li><a href="3.php">Last-Modified is unknown : use hash of content for ETag</a></li>
33         <li><a href="4.php">ConditionalGet + Encoder</a></li>
34         <li><a href="5.php">Last-Modified + Expires</a></li>
35 </ul>
36 <h2>Notes</h2>
37 <h3>How to distinguish 200 and 304 responses</h3>
38 <p>For these pages all 200 responses are sent in chunks a second apart, so you
39 should notice that 304 responses are quicker. You can also use HTTP sniffers
40 like <a href="http://www.fiddlertool.com/">Fiddler (win)</a> and
41 <a href="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders (Firefox add-on)</a>
42 to verify headers and content being sent.</p>
43 <h3>Browser notes</h3>
44 <dl>
45         <dt>Opera</dt>
46         <dd>Opera has a couple behaviors against the HTTP spec: Manual refreshes (F5)
47     prevents the ETag/If-Modified-Since headers from being sent; it only sends
48     them when following a link or bookmark. Also, Opera will not honor the
49     <code>must-revalidate</code> Cache-Control value unless <code>max-age</code>
50     is set. To get Opera to follow the spec, ConditionalGet will send Opera max-age=0
51     (if one is not already set).</dd>
52         <dt>Safari</dt>
53         <dd>ETag validation is unsupported, but Safari supports HTTP/1.0 validation via
54                  If-Modified-Since headers as long as the cache is explicitly marked
55                 "public" or "private" ("private" is default in ConditionalGet).</dd>
56 </dl>
57 </body>
58 </html>
59 <?php
60     $content = ob_get_contents();
61     ob_end_clean();
62     return $content;
63 }
64 \r