Skip to content
Snippets Groups Projects
Unverified Commit b2996720 authored by Dick Visser's avatar Dick Visser Committed by GitHub
Browse files

Actually handle ETag/If-None-Match logic (#1673)


* Actually handle ETag/If-None-Match logic

* send metadata when no match

* Simplify if else

* Fix syntax error + coding style

Co-authored-by: default avatarTim van Dijen <tvdijen@gmail.com>
parent 6a6bcdf6
No related branches found
No related tags found
No related merge requests found
...@@ -242,9 +242,15 @@ try { ...@@ -242,9 +242,15 @@ try {
$t->data['metadataflat'] = htmlspecialchars($metaflat); $t->data['metadataflat'] = htmlspecialchars($metaflat);
$t->show(); $t->show();
} else { } else {
$etag = '"' . hash('sha256', $metaxml) . '"';
if (isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
if ($_SERVER['HTTP_IF_NONE_MATCH'] === $etag) {
header("HTTP/1.1 304 Not Modified");
exit(0);
}
}
header('Content-Type: application/samlmetadata+xml'); header('Content-Type: application/samlmetadata+xml');
header('ETag: "' . hash('sha256', $metaxml) . '"'); header('ETag: ' . $etag);
echo $metaxml; echo $metaxml;
exit(0); exit(0);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment