diff options
author | Thomas Roth <code@leveldown.de> | 2010-02-24 23:59:54 +0100 |
---|---|---|
committer | Thomas Roth <code@leveldown.de> | 2010-02-24 23:59:54 +0100 |
commit | 6d41b27f534a97c116c30701485595a574df24f0 (patch) | |
tree | 861c51fcdbdfc6c74ab4687cff2b02afaf49d6a7 | |
parent | 0fc864c419964d00b789faaa727362e7e36b6e6e (diff) | |
download | mitmproxy-6d41b27f534a97c116c30701485595a574df24f0.tar.gz mitmproxy-6d41b27f534a97c116c30701485595a574df24f0.tar.bz2 mitmproxy-6d41b27f534a97c116c30701485595a574df24f0.zip |
Fixes crash on illegal regular expression for interception.
-rw-r--r-- | libmproxy/filt.py | 12 | ||||
-rw-r--r-- | todo | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/libmproxy/filt.py b/libmproxy/filt.py index 49fff6c7..1dba3153 100644 --- a/libmproxy/filt.py +++ b/libmproxy/filt.py @@ -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(): @@ -14,7 +14,5 @@ Future: Bugs: - - Exception handling for regular expression compiler in filt.py. - - Fix crash on illegal regular expression on libmproxy/filt.py:76 - In some circumstances, long URLs in list view are line-broken oddly. - Termination sometimes hangs. |