本文整理汇总了C++中SecurityOrigin::isSameSchemeHostPort方法的典型用法代码示例。如果您正苦于以下问题:C++ SecurityOrigin::isSameSchemeHostPort方法的具体用法?C++ SecurityOrigin::isSameSchemeHostPort怎么用?C++ SecurityOrigin::isSameSchemeHostPort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityOrigin
的用法示例。
在下文中一共展示了SecurityOrigin::isSameSchemeHostPort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendPing
// http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing
void PingLoader::sendPing(Frame* frame, const KURL& pingURL, const KURL& destinationURL)
{
ResourceRequest request(pingURL);
#if PLATFORM(BLACKBERRY)
request.setTargetType(ResourceRequest::TargetIsSubresource);
#endif
request.setHTTPMethod("POST");
request.setHTTPContentType("text/ping");
request.setHTTPBody(FormData::create("PING"));
request.setHTTPHeaderField("Cache-Control", "max-age=0");
frame->loader()->addExtraFieldsToSubresourceRequest(request);
SecurityOrigin* sourceOrigin = frame->document()->securityOrigin();
RefPtr<SecurityOrigin> pingOrigin = SecurityOrigin::create(pingURL);
FrameLoader::addHTTPOriginIfNeeded(request, sourceOrigin->toString());
request.setHTTPHeaderField("Ping-To", destinationURL);
if (!SecurityPolicy::shouldHideReferrer(pingURL, frame->loader()->outgoingReferrer())) {
request.setHTTPHeaderField("Ping-From", frame->document()->url());
if (!sourceOrigin->isSameSchemeHostPort(pingOrigin.get())) {
String referrer = SecurityPolicy::generateReferrerHeader(frame->document()->referrerPolicy(), pingURL, frame->loader()->outgoingReferrer());
if (!referrer.isEmpty())
request.setHTTPReferrer(referrer);
}
}
OwnPtr<PingLoader> pingLoader = adoptPtr(new PingLoader(frame, request));
// Leak the ping loader, since it will kill itself as soon as it receives a response.
PingLoader* leakedPingLoader = pingLoader.leakPtr();
UNUSED_PARAM(leakedPingLoader);
}