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

Side by Side Diff: LayoutTests/http/tests/xmlhttprequest/resources/access-control-preflight-request-header-lowercase.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, 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
OLDNEW
1 <?php 1 <?php
2 require_once '../../resources/portabilityLayer.php';
3
4 header("Access-Control-Allow-Origin: *"); 2 header("Access-Control-Allow-Origin: *");
5 header("Access-Control-Max-Age: 0"); 3 header("Access-Control-Max-Age: 0");
6 4
7 if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") { 5 if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") {
8 // Split the Access-Control-Request-header value based on the token. 6 // Split the Access-Control-Request-header value based on the token.
9 $accessControlRequestHeaderValues = explode(", ", $_SERVER["HTTP_ACCESS_CONT ROL_REQUEST_HEADERS"]); 7 $accessControlRequestHeaderValues = explode(", ", $_SERVER["HTTP_ACCESS_CONT ROL_REQUEST_HEADERS"]);
10 if (in_array("x-custom-header", $accessControlRequestHeaderValues)) // Case- sensitive comparison to make sure that browser sends the value in lowercase. 8 if (in_array("x-custom-header", $accessControlRequestHeaderValues)) // Case- sensitive comparison to make sure that browser sends the value in lowercase.
11 header("Access-Control-Allow-Headers: X-Custom-Header"); // Add "Access -Control-Allow-Headers: X-Custom-Header" to "OPTIONS" response. 9 header("Access-Control-Allow-Headers: X-Custom-Header"); // Add "Access -Control-Allow-Headers: X-Custom-Header" to "OPTIONS" response.
12 10
13 } else if ($_SERVER["REQUEST_METHOD"] == "GET") { 11 } else if ($_SERVER["REQUEST_METHOD"] == "GET") {
14 if (isset($_SERVER["HTTP_X_CUSTOM_HEADER"])) 12 if (isset($_SERVER["HTTP_X_CUSTOM_HEADER"]))
15 echo "PASS"; 13 echo "PASS";
16 else 14 else
17 echo "FAIL"; 15 echo "FAIL";
18 } 16 }
19 ?> 17 ?>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698