| OLD | NEW |
| 1 <?php | 1 <?php |
| 2 header('X-ServiceWorker-ServerHeader: SetInTheServer'); | 2 header('X-ServiceWorker-ServerHeader: SetInTheServer'); |
| 3 | 3 |
| 4 $prefix = ''; | 4 $prefix = ''; |
| 5 // If PreflightTest is set: | 5 // If PreflightTest is set: |
| 6 // - Use PACAOrign, PACAHeaders, PACAMethods, PACACredentials, PACEHeaders, | 6 // - Use PACAOrign, PACAHeaders, PACAMethods, PACACredentials, PACEHeaders, |
| 7 // PAuth, and PAuthFail parameters in preflight. | 7 // PAuth, and PAuthFail parameters in preflight. |
| 8 // - Use $_GET['PreflightTest'] as HTTP status code. | 8 // - Use $_GET['PreflightTest'] as HTTP status code. |
| 9 // - Check Access-Control-Request-Method/Headers headers with | 9 // - Check Access-Control-Request-Method/Headers headers with |
| 10 // PACRMethod/Headers parameter, if set, in preflight. | 10 // PACRMethod/Headers parameter, if set, in preflight. |
| 11 if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && isset($_GET['PreflightTest'])) { | 11 if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && isset($_GET['PreflightTest'])) { |
| 12 $prefix = 'P'; | 12 $prefix = 'P'; |
| 13 | 13 |
| 14 if (isset($_GET['PACRMethod']) && | 14 if (isset($_GET['PACRMethod']) && |
| 15 $_GET['PACRMethod'] != | 15 $_GET['PACRMethod'] != |
| 16 $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']) { | 16 $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']) { |
| 17 header("HTTP/1.1 400"); | 17 header("HTTP/1.1 400"); |
| 18 exit; | 18 exit; |
| 19 } | 19 } |
| 20 if (isset($_GET['PACRHeaders']) && | 20 if (isset($_GET['PACRHeaders']) && |
| 21 $_GET['PACRHeaders'] != | 21 $_GET['PACRHeaders'] != |
| 22 $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']) { | 22 $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']) { |
| 23 header("HTTP/1.1 400"); | 23 header("HTTP/1.1 400"); |
| 24 exit; | 24 exit; |
| 25 } | 25 } |
| 26 header("HTTP/1.1 {$_GET['PreflightTest']}"); | 26 header("HTTP/1.1 {$_GET['PreflightTest']}"); |
| 27 } | 27 } |
| 28 | 28 |
| 29 if (isset($_GET[$prefix . 'Redirect'])) { |
| 30 header('Location: ' . $_GET[$prefix . 'Redirect']); |
| 31 } |
| 32 |
| 29 if (isset($_GET[$prefix . 'ACAOrigin'])) { | 33 if (isset($_GET[$prefix . 'ACAOrigin'])) { |
| 30 $origins = explode(',', $_GET[$prefix . 'ACAOrigin']); | 34 $origins = explode(',', $_GET[$prefix . 'ACAOrigin']); |
| 31 for ($i = 0; $i < sizeof($origins); ++$i) | 35 for ($i = 0; $i < sizeof($origins); ++$i) |
| 32 header("Access-Control-Allow-Origin: " . $origins[$i], false); | 36 header("Access-Control-Allow-Origin: " . $origins[$i], false); |
| 33 } | 37 } |
| 34 if (isset($_GET[$prefix . 'ACAHeaders'])) | 38 if (isset($_GET[$prefix . 'ACAHeaders'])) |
| 35 header('Access-Control-Allow-Headers: ' . $_GET[$prefix . 'ACAHeaders']); | 39 header('Access-Control-Allow-Headers: ' . $_GET[$prefix . 'ACAHeaders']); |
| 36 if (isset($_GET[$prefix . 'ACAMethods'])) | 40 if (isset($_GET[$prefix . 'ACAMethods'])) |
| 37 header('Access-Control-Allow-Methods: ' . $_GET[$prefix . 'ACAMethods']); | 41 header('Access-Control-Allow-Methods: ' . $_GET[$prefix . 'ACAMethods']); |
| 38 if (isset($_GET[$prefix . 'ACACredentials'])) | 42 if (isset($_GET[$prefix . 'ACACredentials'])) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 'body' => file_get_contents('php://input'), | 98 'body' => file_get_contents('php://input'), |
| 95 'files' => $files, | 99 'files' => $files, |
| 96 'get' => $_GET, | 100 'get' => $_GET, |
| 97 'post' => $_POST, | 101 'post' => $_POST, |
| 98 'username' => $username, | 102 'username' => $username, |
| 99 'password' => $password, | 103 'password' => $password, |
| 100 'cookie' => $cookie); | 104 'cookie' => $cookie); |
| 101 $json = json_encode($arr); | 105 $json = json_encode($arr); |
| 102 echo "report( $json );"; | 106 echo "report( $json );"; |
| 103 ?> | 107 ?> |
| OLD | NEW |