mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
speed up filters
This commit is contained in:
parent
ee8e5947df
commit
00561d280c
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user