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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 2471533005: Preserve custom headers when following cross-origin redirects. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index 057990a8b4c0e59c43877dde79d92343fef63910..b027093afb3d66e288186082038a87ae11750e35 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -199,22 +199,10 @@ void DocumentThreadableLoader::start(const ResourceRequest& request) {
m_requestStartedSeconds = monotonicallyIncreasingTime();
- // Save any CORS simple headers on the request here. If this request redirects
+ // Save any headers on the request here. If this request redirects
// cross-origin, we cancel the old request create a new one, and copy these
// headers.
- const HTTPHeaderMap& headerMap = request.httpHeaderFields();
- for (const auto& header : headerMap) {
- if (FetchUtils::isSimpleHeader(header.key, header.value)) {
- m_simpleRequestHeaders.add(header.key, header.value);
- } else if (equalIgnoringCase(header.key, HTTPNames::Range) &&
- m_options.crossOriginRequestPolicy == UseAccessControl &&
- m_options.preflightPolicy == PreventPreflight) {
- // Allow an exception for the "range" header for when CORS callers request
- // no preflight, this ensures cross-origin redirects work correctly for
- // crossOrigin enabled WebURLRequest::RequestContextVideo type requests.
- m_simpleRequestHeaders.add(header.key, header.value);
- }
- }
+ m_requestHeaders = request.httpHeaderFields();
// DocumentThreadableLoader is used by all javascript initiated fetch, so we
// use this chance to record non-GET fetch script requests. However, this is
@@ -647,9 +635,9 @@ bool DocumentThreadableLoader::redirectReceived(
crossOriginRequest.clearHTTPReferrer();
crossOriginRequest.clearHTTPOrigin();
crossOriginRequest.clearHTTPUserAgent();
- // Add any CORS simple request headers which we previously saved from the
+ // Add any request headers which we previously saved from the
// original request.
- for (const auto& header : m_simpleRequestHeaders)
+ for (const auto& header : m_requestHeaders)
crossOriginRequest.setHTTPHeaderField(header.key, header.value);
makeCrossOriginAccessRequest(crossOriginRequest);
« no previous file with comments | « third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698