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

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

Issue 416353002: [ServiceWorker] Add test for cookies of fetch() in ServiceWorker (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
OLDNEW
1 <?php 1 <?php
2 header('X-ServiceWorker-ServerHeader: SetInTheServer'); 2 header('X-ServiceWorker-ServerHeader: SetInTheServer');
3 if (isset($_GET['ACAOrigin'])) { 3 if (isset($_GET['ACAOrigin'])) {
4 $origins = explode(',', $_GET['ACAOrigin']); 4 $origins = explode(',', $_GET['ACAOrigin']);
5 for ($i = 0; $i < sizeof($origins); ++$i) 5 for ($i = 0; $i < sizeof($origins); ++$i)
6 header("Access-Control-Allow-Origin: " . $origins[$i], false); 6 header("Access-Control-Allow-Origin: " . $origins[$i], false);
7 } 7 }
8 8
9 if (isset($_GET['ACAHeaders'])) 9 if (isset($_GET['ACAHeaders']))
10 header("Access-Control-Allow-Headers: {$_GET['ACAHeaders']}"); 10 header("Access-Control-Allow-Headers: {$_GET['ACAHeaders']}");
11 if (isset($_GET['ACAMethods'])) 11 if (isset($_GET['ACAMethods']))
12 header("Access-Control-Allow-Methods: {$_GET['ACAMethods']}"); 12 header("Access-Control-Allow-Methods: {$_GET['ACAMethods']}");
13 if (isset($_GET['ACACredentials'])) 13 if (isset($_GET['ACACredentials']))
14 header("Access-Control-Allow-Credentials: {$_GET['ACACredentials']}"); 14 header("Access-Control-Allow-Credentials: {$_GET['ACACredentials']}");
15 if (isset($_GET['ACEHeaders'])) 15 if (isset($_GET['ACEHeaders']))
16 header("Access-Control-Expose-Headers: {$_GET['ACEHeaders']}"); 16 header("Access-Control-Expose-Headers: {$_GET['ACEHeaders']}");
17 17
18 if ((isset($_GET['Auth']) and !isset($_SERVER['PHP_AUTH_USER'])) || isset($_GET[ 'AuthFail'])) { 18 if ((isset($_GET['Auth']) and !isset($_SERVER['PHP_AUTH_USER'])) || isset($_GET[ 'AuthFail'])) {
19 header('WWW-Authenticate: Basic realm="Restricted"'); 19 header('WWW-Authenticate: Basic realm="Restricted"');
20 header('HTTP/1.0 401 Unauthorized'); 20 header('HTTP/1.0 401 Unauthorized');
21 echo 'Authentication canceled'; 21 echo 'Authentication canceled';
22 exit; 22 exit;
23 } 23 }
24 24
25 $username = 'undefined'; 25 $username = 'undefined';
26 $password = 'undefined'; 26 $password = 'undefined';
27 $cookie = 'undefined';
27 if (isset($_SERVER['PHP_AUTH_USER'])) { 28 if (isset($_SERVER['PHP_AUTH_USER'])) {
28 $username = $_SERVER['PHP_AUTH_USER']; 29 $username = $_SERVER['PHP_AUTH_USER'];
29 } 30 }
30 if (isset($_SERVER['PHP_AUTH_PW'])) { 31 if (isset($_SERVER['PHP_AUTH_PW'])) {
31 $password = $_SERVER['PHP_AUTH_PW']; 32 $password = $_SERVER['PHP_AUTH_PW'];
32 } 33 }
34 if (isset($_COOKIE['cookie'])) {
35 $cookie = $_COOKIE['cookie'];
36 }
33 37
34 header('Content-Type: application/json'); 38 header('Content-Type: application/json');
35 $arr = array('jsonpResult' => 'success', 39 $arr = array('jsonpResult' => 'success',
36 'method' => $_SERVER['REQUEST_METHOD'], 40 'method' => $_SERVER['REQUEST_METHOD'],
37 'headers' => getallheaders(), 41 'headers' => getallheaders(),
38 'username' => $username, 42 'username' => $username,
39 'password' => $password); 43 'password' => $password,
44 'cookie' => $cookie);
40 $json = json_encode($arr); 45 $json = json_encode($arr);
41 echo "report( $json );"; 46 echo "report( $json );";
42 ?> 47 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698