File: etag.php

package info (click to toggle)
siege 4.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,676 kB
  • sloc: ansic: 13,015; sh: 9,149; makefile: 160; php: 142; perl: 11
file content (30 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
  $v = "v2";
  $d = date('i');

  $etag = "ETag: \"" . $v . "." . $d . "\"";

  if(isset($_SERVER['HTTP_IF_NONE_MATCH']) && eregi($_SERVER['HTTP_IF_NONE_MATCH'], $etag)){
    header("HTTP/1.1 304 Not Modified"); 
    header($etag);
    exit(0);
  } else {
    header($etag);
    echo "<html>";
    echo "<head><title>SIEGE: Etity Tag Test</title></head>";
    echo "<body>";
    echo "<h2>Siege Entity Tags</h2>";
    echo "This page sets a entity tag every minute. The header looks like this:<br>";
    echo "<code>";
    echo "$etag";
    echo "</code><br><br>";
    echo "To test ETags response, you should enable them in your apache webserver. To do this <br>";
    echo "on apache, you should add the following directive at the server, virtual host, directory <br>";
    echo "or .htaccess level:<br><br>";
    echo "<code>";
    echo "FileETag INode MTime Size";
    echo "</code>";
    echo "</body>";
    echo "</html>";
  }
?>