| 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, PAuthFail and PSetCookie* parameters in preflight. | 7 // PAuth, PAuthFail and PSetCookie* 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. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 exit; | 24 exit; |
| 25 } | 25 } |
| 26 // Preflight must not include Cookie headers. | 26 // Preflight must not include Cookie headers. |
| 27 if (isset($_SERVER['HTTP_COOKIE'])) { | 27 if (isset($_SERVER['HTTP_COOKIE'])) { |
| 28 header("HTTP/1.1 400"); | 28 header("HTTP/1.1 400"); |
| 29 exit; | 29 exit; |
| 30 } | 30 } |
| 31 header("HTTP/1.1 {$_GET['PreflightTest']}"); | 31 header("HTTP/1.1 {$_GET['PreflightTest']}"); |
| 32 } | 32 } |
| 33 | 33 |
| 34 if (isset($_GET['Redirect'])) { |
| 35 if (isset($_GET['Status'])) { |
| 36 header("HTTP/1.1 $_GET[Status]"); |
| 37 } else { |
| 38 header('HTTP/1.1 302'); |
| 39 } |
| 40 $url = $_GET['Redirect']; |
| 41 if ($url !== 'noLocation') { |
| 42 header("Location: $url"); |
| 43 } |
| 44 } |
| 34 if (isset($_GET[$prefix . 'ACAOrigin'])) { | 45 if (isset($_GET[$prefix . 'ACAOrigin'])) { |
| 35 $origins = explode(',', $_GET[$prefix . 'ACAOrigin']); | 46 $origins = explode(',', $_GET[$prefix . 'ACAOrigin']); |
| 36 for ($i = 0; $i < sizeof($origins); ++$i) | 47 for ($i = 0; $i < sizeof($origins); ++$i) |
| 37 header("Access-Control-Allow-Origin: " . $origins[$i], false); | 48 header("Access-Control-Allow-Origin: " . $origins[$i], false); |
| 38 } | 49 } |
| 39 if (isset($_GET[$prefix . 'ACAHeaders'])) | 50 if (isset($_GET[$prefix . 'ACAHeaders'])) |
| 40 header('Access-Control-Allow-Headers: ' . $_GET[$prefix . 'ACAHeaders']); | 51 header('Access-Control-Allow-Headers: ' . $_GET[$prefix . 'ACAHeaders']); |
| 41 if (isset($_GET[$prefix . 'ACAMethods'])) | 52 if (isset($_GET[$prefix . 'ACAMethods'])) |
| 42 header('Access-Control-Allow-Methods: ' . $_GET[$prefix . 'ACAMethods']); | 53 header('Access-Control-Allow-Methods: ' . $_GET[$prefix . 'ACAMethods']); |
| 43 if (isset($_GET[$prefix . 'ACACredentials'])) | 54 if (isset($_GET[$prefix . 'ACACredentials'])) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 'headers' => getallheaders(), | 113 'headers' => getallheaders(), |
| 103 'body' => file_get_contents('php://input'), | 114 'body' => file_get_contents('php://input'), |
| 104 'files' => $files, | 115 'files' => $files, |
| 105 'get' => $_GET, | 116 'get' => $_GET, |
| 106 'post' => $_POST, | 117 'post' => $_POST, |
| 107 'username' => $username, | 118 'username' => $username, |
| 108 'password' => $password, | 119 'password' => $password, |
| 109 'cookie' => $cookie); | 120 'cookie' => $cookie); |
| 110 $json = json_encode($arr); | 121 $json = json_encode($arr); |
| 111 echo "report( $json );"; | 122 echo "report( $json );"; |
| 112 ?> | 123 ?> |
| OLD | NEW |