From d2aa969206aa1b7738b911cdaf29038f249b5066 Mon Sep 17 00:00:00 2001 From: Corey Frang Date: Tue, 26 Nov 2013 12:45:39 -0600 Subject: [PATCH] Ajax: Use weak ETag header in tests See http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation Close gh-1448 --- test/data/etag.php | 7 +++++-- 1 file 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; -- 2.39.5