| Index: LayoutTests/http/tests/css/resources/referrer-check.php
|
| diff --git a/LayoutTests/http/tests/css/resources/referrer-check.php b/LayoutTests/http/tests/css/resources/referrer-check.php
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2e8b00ba818e77b386df4f3883d0c25552e5e5e8
|
| --- /dev/null
|
| +++ b/LayoutTests/http/tests/css/resources/referrer-check.php
|
| @@ -0,0 +1,52 @@
|
| +<?php
|
| +
|
| +function getReferrerPath() {
|
| + if (!isset($_SERVER["HTTP_REFERER"]))
|
| + return "";
|
| + $url = parse_url($_SERVER["HTTP_REFERER"]);
|
| + return $url['path'];
|
| +}
|
| +
|
| +function putImage() {
|
| + $image = "../../resources/square100.png";
|
| + header("Content-Type: image/png");
|
| + header("Content-Length: " . filesize($image));
|
| + header("Access-Control-Allow-Origin: *");
|
| + ob_clean();
|
| + flush();
|
| + readfile($image);
|
| +}
|
| +
|
| +function putFont() {
|
| + $font = "../../../../resources/Ahem.ttf";
|
| + header("Content-Type: font/truetype");
|
| + header("Content-Length: " . filesize($font));
|
| + header("Access-Control-Allow-Origin: *");
|
| + ob_clean();
|
| + flush();
|
| + readfile($font);
|
| +}
|
| +
|
| +$expectedReferrerPaths = array(
|
| + "document" => "/css/css-resources-referrer.html",
|
| + "sheet" => "/css/resources/css-resources-referrer.css",
|
| + "importedSheet" => "/css/resources/css-resources-referrer-import.css",
|
| + "iframe" => "/from/iframe.html"
|
| +);
|
| +
|
| +$from = $_GET["from"];
|
| +$resource = $_GET["resource"];
|
| +$referrerPath = getReferrerPath();
|
| +
|
| +if ($referrerPath === $expectedReferrerPaths[$from]) {
|
| + if ($resource === "image" || $resource === "image2")
|
| + putImage();
|
| + else if ($resource === "font")
|
| + putFont();
|
| + else
|
| + header("HTTP/1.1 500 Internal Server Error");
|
| +} else {
|
| + header("HTTP/1.1 500 Internal Server Error");
|
| +}
|
| +
|
| +?>
|
|
|