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

Unified Diff: LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-invalid-status.php

Issue 21532002: CORS: Handle error HTTP status code 4XX/5XX in preflight requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-invalid-status.php
diff --git a/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-invalid-status.php b/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-invalid-status.php
new file mode 100755
index 0000000000000000000000000000000000000000..8333aaec3fea187e04e70089ce46c3d1385a4b59
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-invalid-status.php
@@ -0,0 +1,23 @@
+<?php
+ $code = $_GET['code'];
+ $request_origin_value = $_SERVER["HTTP_ORIGIN"];
+ $access_control_request_headers = $_SERVER["HTTP_ACCESS_CONTROL_REQUEST_HEADERS"];
+
+ if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
+ if ($code == "400") {
+ header("HTTP/1.1 400");
+ }
+ else if ($code == "501"){
+ header("HTTP/1.1 501");
+ }
+ header("Access-Control-Allow-Methods: GET");
+ header("Access-Control-Max-Age: 1");
+ } else {
+ header("HTTP/1.1 200");
+ }
+ if (!is_null($request_origin_value)) {
+ header("Access-Control-Allow-Origin: $request_origin_value");
+ }
+ if (!is_null($access_control_request_headers))
+ header("Access-Control-Allow-Headers: $access_control_request_headers");
+?>

Powered by Google App Engine
This is Rietveld 408576698