Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php

Issue 897923003: [Test] [Fetch][XHR] Patch for testing Location header in Preflight Response (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ?>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698