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

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

Issue 2360753002: Cross-origin https->https pings should omit Ping-From header (Closed)
Patch Set: More tests Created 4 years, 3 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 | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/loader/PingLoaderTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/PingLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp
index eda58be918b50d7320748d833e0cc1b2af001d46..5cae751884d74ec930c09937c27121279573a754 100644
--- a/third_party/WebKit/Source/core/loader/PingLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -445,6 +445,9 @@ void PingLoader::loadImage(LocalFrame* frame, const KURL& url)
// http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing
void PingLoader::sendLinkAuditPing(LocalFrame* frame, const KURL& pingURL, const KURL& destinationURL)
{
+ if (!pingURL.protocolIsInHTTPFamily())
+ return;
+
ResourceRequest request(pingURL);
request.setHTTPMethod(HTTPNames::POST);
request.setHTTPContentType("text/ping");
@@ -458,8 +461,8 @@ void PingLoader::sendLinkAuditPing(LocalFrame* frame, const KURL& pingURL, const
request.setHTTPHeaderField(HTTPNames::Ping_To, AtomicString(destinationURL.getString()));
- // Ping-From follows the same rules as the default referrer beahavior for subresource requests.
- if (!SecurityPolicy::shouldHideReferrer(pingURL, frame->document()->url().getString()))
+ RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL);
+ if (protocolIs(frame->document()->url().getString(), "http") || frame->document()->getSecurityOrigin()->canAccess(pingOrigin.get()))
request.setHTTPHeaderField(HTTPNames::Ping_From, AtomicString(frame->document()->url().getString()));
sendPingCommon(frame, request, FetchInitiatorTypeNames::ping, AllowStoredCredentials, false);
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/loader/PingLoaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698