blob: 068de4872090b12efffe0a89f6f9d5d47e9eea7d [file] [log] [blame]
<?php
if ($_SERVER["REQUEST_METHOD"] == "OPTIONS")
die("Got unexpected preflight request");
header("Content-Type: text/event-stream");
$count = intval($_GET["count"]);
if ($_GET["cors"])
header("Access-Control-Allow-Origin: " . $_GET["cors"]);
else if ($count == 2)
header("Access-Control-Allow-Origin: http://some.other.origin:80");
else if ($count == 3)
header("Access-Control-Allow-Origin: *");
else if ($count > 3)
header("Access-Control-Allow-Origin: " . $_SERVER["HTTP_ORIGIN"]);
if ($_SERVER["HTTP_LAST_EVENT_ID"] != "77")
echo "id: 77\ndata: DATA1\nretry: 0\n\n";
else
echo "data: DATA2\n\n";
?>