Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php |
| diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php b/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fe76c4251409bfcbeb48dcab1f81b41d0a055fb6 |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php |
| @@ -0,0 +1,33 @@ |
| +<?php |
| +header('X-ServiceWorker-ServerHeader: SetInTheServer'); |
| +if (isset($_GET['ACAOrigin'])) { |
| + $origins = explode(',', $_GET['ACAOrigin']); |
| + for ($i = 0; $i < sizeof($origins); ++$i) |
| + header("Access-Control-Allow-Origin: " . $origins[$i], false); |
|
falken
2014/07/25 05:41:29
this looks indented too much
horo
2014/07/25 06:00:56
Done.
|
| +} |
| + |
| +if (isset($_GET['ACAHeaders'])) |
| + header("Access-Control-Allow-Headers: {$_GET['ACAHeaders']}"); |
| +if (isset($_GET['ACAMethods'])) |
| + header("Access-Control-Allow-Methods: {$_GET['ACAMethods']}"); |
| +if (isset($_GET['ACACredentials'])) |
| + header("Access-Control-Allow-Credentials: {$_GET['ACACredentials']}"); |
| +if (isset($_GET['ACEHeaders'])) |
| + header("Access-Control-Expose-Headers: {$_GET['ACEHeaders']}"); |
| + |
| +if ((isset($_GET['Auth']) and !isset($_SERVER['PHP_AUTH_USER'])) || isset($_GET['AuthFail'])) { |
| + header('WWW-Authenticate: Basic realm="Restricted"'); |
| + header('HTTP/1.0 401 Unauthorized'); |
| + echo 'Authentication canceled'; |
| + exit; |
| +} |
| + |
| +header('Content-Type: application/json'); |
| +$arr = array('jsonpResult' => 'success', |
| + 'method' => $_SERVER['REQUEST_METHOD'], |
| + 'headers' => getallheaders(), |
| + 'username' => $_SERVER['PHP_AUTH_USER'], |
| + 'password' => $_SERVER['PHP_AUTH_PW']); |
| +$json = json_encode($arr); |
| +echo "report( $json );"; |
| +?> |