mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-21 22:58:24 +00:00
Fixes crash on illegal regular expression for interception.
This commit is contained in:
parent
0fc864c419
commit
6d41b27f53
@ -73,8 +73,10 @@ class FResp(_Action):
|
||||
class _Rex(_Action):
|
||||
def __init__(self, expr):
|
||||
self.expr = expr
|
||||
self.re = re.compile(self.expr)
|
||||
|
||||
try:
|
||||
self.re = re.compile(self.expr)
|
||||
except:
|
||||
self.re = False
|
||||
|
||||
def _check_content_type(expr, o):
|
||||
val = o.headers.get("content-type")
|
||||
@ -186,7 +188,11 @@ class FUrl(_Rex):
|
||||
def make(klass, s, loc, toks):
|
||||
if len(toks) > 1:
|
||||
toks = toks[1:]
|
||||
return klass(*toks)
|
||||
ret_klass = klass(*toks)
|
||||
if ret_klass.re:
|
||||
return ret_klass
|
||||
else:
|
||||
return False
|
||||
|
||||
def __call__(self, o):
|
||||
if o.is_response():
|
||||
|
Loading…
Reference in New Issue
Block a user