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

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

Issue 875363002: Sort header names in Access-Control-Request-Headers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tyoshino's comments Created 5 years, 11 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-header-sorted.php
diff --git a/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-header-sorted.php b/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-header-sorted.php
new file mode 100644
index 0000000000000000000000000000000000000000..fb44c44b99f850d26b5b5384424a2bba1836104a
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-header-sorted.php
@@ -0,0 +1,22 @@
+<?php
+if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") {
+ // Check that the names in Access-Control-Request-Headers are
+ // "sorted lexicographically, and byte lowercased".
+ // Fetch API Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch-0
+ if ($_SERVER["HTTP_ACCESS_CONTROL_REQUEST_HEADERS"] ==
+ 'x-custom-s, x-custom-test, x-custom-u, x-custom-ua, x-custom-v') {
+ header("Access-Control-Allow-Headers: x-custom-s, x-custom-test, x-custom-u, x-custom-ua, x-custom-v");
+ } else {
+ header("HTTP/1.1 400");
+ }
+ header("Access-Control-Allow-Origin: *");
+ header("Access-Control-Max-Age: 0");
+} else if ($_SERVER["REQUEST_METHOD"] == "GET") {
+ header("Access-Control-Allow-Origin: *");
+ header("Access-Control-Max-Age: 0");
+ if (isset($_SERVER["HTTP_X_CUSTOM_S"]))
+ echo "PASS";
+ else
+ echo "FAIL";
+}
+?>

Powered by Google App Engine
This is Rietveld 408576698