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

Unified Diff: third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp

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/Source/core/fetch/CrossOriginAccessControl.cpp
diff --git a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
index 2e8c98ac2ed9b288e0eb1e83285c9cf87c8de604..ff43d8812f29a747f37b100e4e7763b396c61127 100644
--- a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
+++ b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
@@ -70,6 +70,8 @@ static AtomicString createAccessControlRequestHeadersHeader(
}
filteredHeaders.push_back(header.key.lower());
}
+ if (!filteredHeaders.size())
+ return nullAtom;
// Sort header names lexicographically.
std::sort(filteredHeaders.begin(), filteredHeaders.end(),
@@ -106,10 +108,11 @@ ResourceRequest createAccessControlPreflightRequest(
HTTPNames::Access_Control_Request_External, "true");
}
- if (request.httpHeaderFields().size() > 0) {
+ AtomicString requestHeaders =
+ createAccessControlRequestHeadersHeader(request.httpHeaderFields());
+ if (requestHeaders != nullAtom) {
preflightRequest.setHTTPHeaderField(
- HTTPNames::Access_Control_Request_Headers,
- createAccessControlRequestHeadersHeader(request.httpHeaderFields()));
+ HTTPNames::Access_Control_Request_Headers, requestHeaders);
}
return preflightRequest;

Powered by Google App Engine
This is Rietveld 408576698