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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/security/cors-rfc1918/resources/preflight.php

Issue 1745083002: CORS-RFC1918: Force preflights for external requests in DocumentThreadableLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test. Created 4 years, 7 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
(Empty)
1 <?PHP
2 //
3 // OPTIONS
4 //
5 if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
6 //
7 // FAIL
8 //
9 if ($_GET['preflight'] == "fail-with-500") {
10 header("HTTP/1.1 500");
11 exit;
12 }
13 if ($_GET['preflight'] == "fail-without-allow") {
14 header("HTTP/1.1 200");
15 header("Access-Control-Allow-Origin: ${_SERVER['HTTP_ORIGIN']}");
16 header("Access-Control-Allow-Methods: GET");
17 exit;
18 }
19
20 //
21 // PASS
22 //
23 if ($_GET['preflight'] == "pass") {
24 header("HTTP/1.1 200");
25 header("Access-Control-Allow-Origin: ${_SERVER['HTTP_ORIGIN']}");
26 header("Access-Control-Allow-Methods: GET");
27 header("Access-Control-Allow-External: true");
28 exit;
29 }
30 }
31
32 //
33 // GET
34 //
35 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
36 header("HTTP/1.1 200");
37 header("Access-Control-Allow-Origin: ${_SERVER['HTTP_ORIGIN']}");
38
39 $arr = array('jsonpResult' => 'success',
40 'method' => $_SERVER['REQUEST_METHOD'],
41 'headers' => getallheaders());
42 $result = json_encode($arr);
43
44 if ($_GET['out'] == "img") {
45 header('Content-Type: image/png');
46 $fn = fopen("abe.png", "r");
47 fpassthru($fn);
48 fclose($fn);
49 exit;
50 } else if ($_GET['out'] == "frame") {
51 echo "<script>window.top.postMessage(${result}, '*');</script>";
52 } else {
53 header('Content-Type: application/json');
54 echo $result;
55 }
56 }
57
58 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698