mirror of
https://github.com/jquery/jquery.git
synced 2025-01-10 18:24:24 +00:00
Ajax: Use weak ETag header in tests
See http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation Close gh-1448
This commit is contained in:
parent
ed291938c2
commit
d2aa969206
@ -4,13 +4,16 @@ error_reporting(0);
|
|||||||
$ts = $_REQUEST['ts'];
|
$ts = $_REQUEST['ts'];
|
||||||
$etag = md5($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) {
|
if ($ifNoneMatch == $etag) {
|
||||||
header('HTTP/1.0 304 Not Modified');
|
header('HTTP/1.0 304 Not Modified');
|
||||||
die; // stop processing
|
die; // stop processing
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Etag: " . $etag);
|
header("Etag: W/\"" . $etag . "\"");
|
||||||
|
|
||||||
if ( $ifNoneMatch ) {
|
if ( $ifNoneMatch ) {
|
||||||
echo "OK: " . $etag;
|
echo "OK: " . $etag;
|
||||||
|
Loading…
Reference in New Issue
Block a user