Browse Source

匹配方法优化。

pull/375/head
王良 2 months ago
parent
commit
ed52dafeb3
  1. 6
      packages/mitmproxy/src/utils/util.match.js

6
packages/mitmproxy/src/utils/util.match.js

@ -2,6 +2,10 @@ const lodash = require('lodash')
const log = require('./util.log')
function isMatched (url, regexp) {
if (regexp === true || regexp === 'true') {
return true
}
try {
let urlRegexp = regexp
if (regexp[0] === '*' || regexp[0] === '?' || regexp[0] === '+') {
@ -15,7 +19,7 @@ function isMatched (url, regexp) {
}
function domainRegexply (target) {
if (target === '.*') {
if (target === '.*' || target === '*' || target === 'true') {
return '^.*$'
}
return '^' + target.replace(/\./g, '\\.').replace(/\*/g, '.*') + '$'

Loading…
Cancel
Save