Skip to content

Commit d2aa969

Browse files
gnarfdmethvin
authored andcommitted
1 parent ed29193 commit d2aa969

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

test/data/etag.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
$ts = $_REQUEST['ts'];
55
$etag = md5($ts);
66

7-
$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : false;
7+
$ifNoneMatch = isset($_SERVER['HTTP_IF_NONE_MATCH']) ? stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) : "";
8+
preg_match('/"([^"]+)"/', $ifNoneMatch, $matches);
9+
$ifNoneMatch = isset($matches[1]) ? $matches[1] : false;
10+
811
if ($ifNoneMatch == $etag) {
912
header('HTTP/1.0 304 Not Modified');
1013
die; // stop processing
1114
}
1215

13-
header("Etag: " . $etag);
16+
header("Etag: W/\"" . $etag . "\"");
1417

1518
if ( $ifNoneMatch ) {
1619
echo "OK: " . $etag;

0 commit comments

Comments
 (0)