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

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 352313003: Make it possible to set the HTTP origin header from content (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/page/CreateWindow.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index 6defc6d323ee37668106994e4e9c88cd705b6561..1c49b8cadf82837eb7c6e9e19b605d45dae2d32f 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -637,7 +637,7 @@ void FrameLoader::setReferrerForFrameRequest(ResourceRequest& request, ShouldSen
request.setHTTPReferrer(Referrer(referrer, originDocument->referrerPolicy()));
RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(referrer);
- addHTTPOriginIfNeeded(request, referrerOrigin->toAtomicString());
+ request.addHTTPOriginIfNeeded(referrerOrigin->toAtomicString());
}
bool FrameLoader::isScriptTriggeredFormSubmissionInChildFrame(const FrameLoadRequest& request) const
@@ -780,7 +780,7 @@ static ResourceRequest requestFromHistoryItem(HistoryItem* item, ResourceRequest
request.setHTTPBody(formData);
request.setHTTPContentType(item->formContentType());
RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::createFromString(item->referrer().referrer);
- FrameLoader::addHTTPOriginIfNeeded(request, securityOrigin->toAtomicString());
+ request.addHTTPOriginIfNeeded(securityOrigin->toAtomicString());
}
return request;
}
@@ -1165,33 +1165,6 @@ void FrameLoader::detachClient()
}
}
-void FrameLoader::addHTTPOriginIfNeeded(ResourceRequest& request, const AtomicString& origin)
-{
- if (!request.httpOrigin().isEmpty())
- return; // Request already has an Origin header.
-
- // Don't send an Origin header for GET or HEAD to avoid privacy issues.
- // For example, if an intranet page has a hyperlink to an external web
- // site, we don't want to include the Origin of the request because it
- // will leak the internal host name. Similar privacy concerns have lead
- // to the widespread suppression of the Referer header at the network
- // layer.
- if (request.httpMethod() == "GET" || request.httpMethod() == "HEAD")
- return;
-
- // For non-GET and non-HEAD methods, always send an Origin header so the
- // server knows we support this feature.
-
- if (origin.isEmpty()) {
- // If we don't know what origin header to attach, we attach the value
- // for an empty origin.
- request.setHTTPOrigin(SecurityOrigin::createUnique()->toAtomicString());
- return;
- }
-
- request.setHTTPOrigin(origin);
-}
-
void FrameLoader::receivedMainResourceError(const ResourceError& error)
{
// Retain because the stop may release the last reference to it.
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/page/CreateWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698