speed up filters

This commit is contained in:
Maximilian Hils 2015-09-04 02:11:09 +02:00
parent ee8e5947df
commit 00561d280c
2 changed files with 9 additions and 14 deletions

View File

@ -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):

View File

@ -7,7 +7,7 @@ from netlib import odict
from netlib.tcp import NetLibError, Address
from netlib.http.http1 import HTTP1Protocol
from netlib.http.http2 import HTTP2Protocol
from netlib.http.http2.frame import Frame, PingFrame, GoAwayFrame, PriorityFrame, WindowUpdateFrame
from netlib.http.http2.frame import GoAwayFrame, PriorityFrame, WindowUpdateFrame
from .. import utils
from ..exceptions import InvalidCredentials, HttpException, ProtocolException