mirror of
https://github.com/jquery/jquery.git
synced 2024-10-05 11:34:18 +00:00
d2aa969206
See http://en.wikipedia.org/wiki/HTTP_ETag#Strong_and_weak_validation Close gh-1448
25 lines
490 B
PHP
25 lines
490 B
PHP
<?php
|
|
error_reporting(0);
|
|
|
|
$ts = $_REQUEST['ts'];
|
|
$etag = md5($ts);
|
|
|
|
$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: W/\"" . $etag . "\"");
|
|
|
|
if ( $ifNoneMatch ) {
|
|
echo "OK: " . $etag;
|
|
} else {
|
|
echo "FAIL";
|
|
}
|
|
|
|
?>
|