1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-06-03 02:44:57 +12:00
This commit is contained in:
gorhill 2017-04-01 16:46:27 -04:00
parent 276a1dfa1b
commit 6e8ebd8253
2 changed files with 19 additions and 11 deletions

View file

@ -86,8 +86,6 @@ var onBeforeRequestHandler = function(details) {
return;
}
// console.debug('onBeforeRequestHandler()> "%s": %o', details.url, details);
var requestType = requestTypeNormalizer[details.type] || 'other';
// https://github.com/gorhill/httpswitchboard/issues/303
@ -99,9 +97,9 @@ var onBeforeRequestHandler = function(details) {
var requestURL = details.url;
// Ignore non-http schemes
if ( requestScheme.lastIndexOf('http', 0) !== 0 ) {
µm.logger.writeOne('', 'info', 'request not processed: ' + details.url);
// Ignore non-network schemes
if ( µmuri.isNetworkScheme(requestScheme) === false ) {
µm.logger.writeOne('', 'info', 'request not processed: ' + requestURL);
return;
}
@ -160,7 +158,10 @@ var onBeforeRequestHandler = function(details) {
var onBeforeSendHeadersHandler = function(details) {
var µm = µMatrix;
// console.debug('onBeforeSendHeadersHandler()> "%s": %o', details.url, details);
// Ignore non-network schemes
if ( µm.URI.isNetworkScheme(details.url) === false ) {
return;
}
// Re-classify orphan HTTP requests as behind-the-scene requests. There is
// not much else which can be done, because there are URLs
@ -468,7 +469,6 @@ vAPI.net.onBeforeRequest = {
};
vAPI.net.onBeforeSendHeaders = {
urls: [ 'http://*/*', 'https://*/*' ],
extra: [ 'blocking', 'requestHeaders' ],
callback: onBeforeSendHeadersHandler
};

View file

@ -237,12 +237,20 @@ URI.schemeFromURI = function(uri) {
/******************************************************************************/
URI.isSecureScheme = function(scheme) {
return scheme === 'https' ||
scheme === 'wss' ||
scheme === 'ftps';
URI.isNetworkScheme = function(scheme) {
return this.reNetworkScheme.test(scheme);
};
URI.reNetworkScheme = /^(?:https?|wss?|ftps?)\b/;
/******************************************************************************/
URI.isSecureScheme = function(scheme) {
return this.reSecureScheme.test(scheme);
};
URI.reSecureScheme = /^(?:https|wss|ftps)\b/;
/******************************************************************************/
URI.authorityFromURI = function(uri) {