From 00561d280ccd4aac06b13b434e0aef4492148cb5 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Fri, 4 Sep 2015 02:11:09 +0200 Subject: speed up filters --- libmproxy/filt.py | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'libmproxy/filt.py') diff --git a/libmproxy/filt.py b/libmproxy/filt.py index cfd3a1bc..6abc4a11 100644 --- a/libmproxy/filt.py +++ b/libmproxy/filt.py @@ -35,7 +35,6 @@ from __future__ import absolute_import import re import sys import pyparsing as pp -from .models import decoded class _Token: @@ -179,13 +178,11 @@ class FBod(_Rex): def __call__(self, f): if f.request and f.request.content: - with decoded(f.request): - if re.search(self.expr, f.request.content): - return True + if re.search(self.expr, f.request.get_decoded_content()): + return True if f.response and f.response.content: - with decoded(f.response): - if re.search(self.expr, f.response.content): - return True + if re.search(self.expr, f.response.get_decoded_content()): + return True return False @@ -195,9 +192,8 @@ class FBodRequest(_Rex): def __call__(self, f): if f.request and f.request.content: - with decoded(f.request): - if re.search(self.expr, f.request.content): - return True + if re.search(self.expr, f.request.get_decoded_content()): + return True class FBodResponse(_Rex): @@ -206,9 +202,8 @@ class FBodResponse(_Rex): def __call__(self, f): if f.response and f.response.content: - with decoded(f.response): - if re.search(self.expr, f.response.content): - return True + if re.search(self.expr, f.response.get_decoded_content()): + return True class FMethod(_Rex): -- cgit v1.2.3