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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php

Issue 2633423003: Leave out empty-valued Access-Control-Request-Headers: on preflights. (Closed)
Patch Set: explicitly include safe headers in the (test) request Created 3 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: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php
index 4ff7b75a982040aaa2e7b9a2a20038135e524127..758a2e6293762c48e268cf08765eecf5e4f59a23 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/fetch-access-control.php
@@ -8,6 +8,8 @@ $prefix = '';
// - Use $_GET['PreflightTest'] as HTTP status code.
// - Check Access-Control-Request-Method/Headers headers with
// PACRMethod/Headers parameter, if set, in preflight.
+// The special value 'missing' for PACRHeaders can be used to
+// test for the absence of ACRHeaders on the preflight request.
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && isset($_GET['PreflightTest'])) {
$prefix = 'P';
@@ -17,11 +19,17 @@ if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS' && isset($_GET['PreflightTest'])) {
header("HTTP/1.1 400");
exit;
}
- if (isset($_GET['PACRHeaders']) &&
- $_GET['PACRHeaders'] !=
- $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']) {
- header("HTTP/1.1 400");
- exit;
+ if (isset($_GET['PACRHeaders'])) {
+ if ($_GET['PACRHeaders'] == 'missing') {
+ if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
+ header("HTTP/1.1 400");
+ exit;
+ }
+ } else if ($_GET['PACRHeaders'] !=
+ $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']) {
+ header("HTTP/1.1 400");
+ exit;
+ }
}
// Preflight must not include Cookie headers.
if (isset($_SERVER['HTTP_COOKIE'])) {
@@ -109,4 +117,4 @@ $arr = array('jsonpResult' => 'success',
'cookie' => $cookie);
$json = json_encode($arr);
echo "report( $json );";
-?>
+?>

Powered by Google App Engine
This is Rietveld 408576698