aboutsummaryrefslogtreecommitdiffstats
path: root/test/data
diff options
context:
space:
mode:
authorJohn Resig <jeresig@gmail.com>2009-06-15 13:36:12 +0000
committerJohn Resig <jeresig@gmail.com>2009-06-15 13:36:12 +0000
commit28ab4d32247943e1ae3409b23fe69303df0bc9eb (patch)
treede40a6094ffe08dcb3e49d5f020d57eaed5c822a /test/data
parent030ae6771533a09157347ffe1d28ee08096899da (diff)
downloadjquery-28ab4d32247943e1ae3409b23fe69303df0bc9eb.tar.gz
jquery-28ab4d32247943e1ae3409b23fe69303df0bc9eb.zip
Adding support for etags in $.ajax() - and simplified the if-modified-since implementation. Thanks to Lawrence for the patch! Closes ticket #4764.
Diffstat (limited to 'test/data')
-rw-r--r--test/data/etag.php16
-rw-r--r--test/data/if_modified_since.php15
2 files changed, 31 insertions, 0 deletions
diff --git a/test/data/etag.php b/test/data/etag.php
new file mode 100644
index 000000000..ad05ba8ad
--- /dev/null
+++ b/test/data/etag.php
@@ -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;
+
+?>
diff --git a/test/data/if_modified_since.php b/test/data/if_modified_since.php
new file mode 100644
index 000000000..013f446dc
--- /dev/null
+++ b/test/data/if_modified_since.php
@@ -0,0 +1,15 @@
+<?php
+error_reporting(0);
+
+$ts = $_REQUEST['ts'];
+
+$ifModifiedSince = isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? stripslashes($_SERVER['HTTP_IF_MODIFIED_SINCE']) : false;
+if ($ifModifiedSince == $ts) {
+ header('HTTP/1.0 304 Not Modified');
+ die; // stop processing
+}
+
+header("Last-Modified: " . $ts);
+echo "OK: " . $ts;
+
+?>