add origin and referer to response header

This commit is contained in:
Xiao YiFang 2022-10-15 14:57:18 +08:00
parent 3d5c7d5742
commit 0f83a55c25

View file

@ -9,6 +9,8 @@ WebUrlRequestInterceptor::WebUrlRequestInterceptor(QObject *p)
} }
void WebUrlRequestInterceptor::interceptRequest( QWebEngineUrlRequestInfo &info) { void WebUrlRequestInterceptor::interceptRequest( QWebEngineUrlRequestInfo &info) {
info.setHttpHeader("origin",Utils::Url::getHostBaseFromUrl(info.requestUrl()).toUtf8());
info.setHttpHeader("referer",info.requestUrl().url().toUtf8());
if( GlobalBroadcaster::instance()->getPreference()->disallowContentFromOtherSites && Utils::isExternalLink( info.requestUrl() ) ) if( GlobalBroadcaster::instance()->getPreference()->disallowContentFromOtherSites && Utils::isExternalLink( info.requestUrl() ) )
{ {
//file:// link ,pass //file:// link ,pass