|
@ -111,16 +111,6 @@ var onBeforeRequestHandler = function(details) { |
|
|
specificity = µm.tMatrix.specificityRegister; |
|
|
specificity = µm.tMatrix.specificityRegister; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Enforce strict secure connection?
|
|
|
|
|
|
if ( |
|
|
|
|
|
block === false && |
|
|
|
|
|
tabContext.secure && |
|
|
|
|
|
µmuri.isSecureScheme(requestScheme) === false && |
|
|
|
|
|
µm.tMatrix.evaluateSwitchZ('https-strict', rootHostname) |
|
|
|
|
|
) { |
|
|
|
|
|
block = true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Record request.
|
|
|
// Record request.
|
|
|
// https://github.com/gorhill/httpswitchboard/issues/342
|
|
|
// https://github.com/gorhill/httpswitchboard/issues/342
|
|
|
// The way requests are handled now, it may happen at this point some
|
|
|
// The way requests are handled now, it may happen at this point some
|
|
@ -128,6 +118,15 @@ var onBeforeRequestHandler = function(details) { |
|
|
// been constructed for logging purpose. Use this synthetic URL if
|
|
|
// been constructed for logging purpose. Use this synthetic URL if
|
|
|
// it is available.
|
|
|
// it is available.
|
|
|
var pageStore = µm.mustPageStoreFromTabId(tabId); |
|
|
var pageStore = µm.mustPageStoreFromTabId(tabId); |
|
|
|
|
|
|
|
|
|
|
|
// Enforce strict secure connection?
|
|
|
|
|
|
if ( tabContext.secure && µmuri.isSecureScheme(requestScheme) === false ) { |
|
|
|
|
|
pageStore.hasMixedContent = true; |
|
|
|
|
|
if ( block === false ) { |
|
|
|
|
|
block = µm.tMatrix.evaluateSwitchZ('https-strict', rootHostname); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
pageStore.recordRequest(requestType, requestURL, block); |
|
|
pageStore.recordRequest(requestType, requestURL, block); |
|
|
µm.logger.writeOne(tabId, 'net', rootHostname, requestURL, details.type, block); |
|
|
µm.logger.writeOne(tabId, 'net', rootHostname, requestURL, details.type, block); |
|
|
|
|
|
|
|
@ -244,12 +243,11 @@ var onBeforeSendHeadersHandler = function(details) { |
|
|
headerIndex = headerIndexFromName('referer', requestHeaders); |
|
|
headerIndex = headerIndexFromName('referer', requestHeaders); |
|
|
if ( headerIndex !== -1 ) { |
|
|
if ( headerIndex !== -1 ) { |
|
|
headerValue = requestHeaders[headerIndex].value; |
|
|
headerValue = requestHeaders[headerIndex].value; |
|
|
if ( |
|
|
|
|
|
headerValue !== '' && |
|
|
|
|
|
µm.tMatrix.evaluateSwitchZ('referrer-spoof', rootHostname) |
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
if ( headerValue !== '' ) { |
|
|
var toDomain = µmuri.domainFromHostname(requestHostname); |
|
|
var toDomain = µmuri.domainFromHostname(requestHostname); |
|
|
if ( toDomain !== '' && toDomain !== µmuri.domainFromURI(headerValue) ) { |
|
|
if ( toDomain !== '' && toDomain !== µmuri.domainFromURI(headerValue) ) { |
|
|
|
|
|
pageStore.has3pReferrer = true; |
|
|
|
|
|
if ( µm.tMatrix.evaluateSwitchZ('referrer-spoof', rootHostname) ) { |
|
|
modified = true; |
|
|
modified = true; |
|
|
var newValue; |
|
|
var newValue; |
|
|
if ( details.method === 'GET' ) { |
|
|
if ( details.method === 'GET' ) { |
|
@ -268,6 +266,7 @@ var onBeforeSendHeadersHandler = function(details) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if ( modified ) { |
|
|
if ( modified ) { |
|
|
return { requestHeaders: requestHeaders }; |
|
|
return { requestHeaders: requestHeaders }; |
|
|