aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Frang <gnarf37@gmail.com>2013-11-26 12:45:39 -0600
committerDave Methvin <dave.methvin@gmail.com>2013-11-26 14:04:55 -0500
commitd2aa969206aa1b7738b911cdaf29038f249b5066 (patch)
tree0aeadcbf80773036f6f29cd24209e5bacdb24809
parented291938c287d34fe1183e588e12372e540eb5e7 (diff)
downloadjquery-d2aa969206aa1b7738b911cdaf29038f249b5066.tar.gz
jquery-d2aa969206aa1b7738b911cdaf29038f249b5066.zip
Ajax: Use weak ETag header in tests
See http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation Close gh-1448
-rw-r--r--test/data/etag.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/data/etag.php b/test/data/etag.php
index f6abc26e4..66eca4bb1 100644
--- a/test/data/etag.php
+++ b/test/data/etag.php
@@ -4,13 +4,16 @@ error_reporting(0);
$ts = $_REQUEST['ts'];
$etag = md5($ts);
-$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false;
+$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : "";
+preg_match('/"([^"]+)"/', $ifNoneMatch, $matches);
+$ifNoneMatch = isset($matches[1]) ? $matches[1] : false;
+
if ($ifNoneMatch == $etag) {
header('HTTP/1.0 304 Not Modified');
die; // stop processing
}
-header("Etag: " . $etag);
+header("Etag: W/\"" . $etag . "\"");
if ( $ifNoneMatch ) {
echo "OK: " . $etag;