Adding support for etags in $.ajax() - and simplified the if-modified-since implement...
[jquery.git] / test / data / etag.php
diff --git a/test/data/etag.php b/test/data/etag.php
new file mode 100644 (file)
index 0000000..ad05ba8
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+error_reporting(0);
+
+$ts = $_REQUEST['ts'];
+$etag = md5($ts);
+
+$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false;
+if ($ifNoneMatch == $etag) {
+    header('HTTP/1.0 304 Not Modified');
+    die; // stop processing
+}
+
+header("Etag: " . $etag);
+echo "OK: " . $etag;
+
+?>