diff --git a/mitmproxy/builtins/replace.py b/mitmproxy/builtins/replace.py index c938d6838..df3cab043 100644 --- a/mitmproxy/builtins/replace.py +++ b/mitmproxy/builtins/replace.py @@ -36,9 +36,9 @@ class Replace: for rex, s, cpatt in self.lst: if cpatt(f): if f.response: - f.response.replace(rex, s) + f.response.replace(rex, s, flags=re.DOTALL) else: - f.request.replace(rex, s) + f.request.replace(rex, s, flags=re.DOTALL) def request(self, flow): if not flow.reply.has_message: diff --git a/mitmproxy/filt.py b/mitmproxy/filt.py index 67915e5b6..eb3e392bf 100644 --- a/mitmproxy/filt.py +++ b/mitmproxy/filt.py @@ -244,6 +244,7 @@ class FHeadResponse(_Rex): class FBod(_Rex): code = "b" help = "Body" + flags = re.DOTALL @only(HTTPFlow, TCPFlow) def __call__(self, f): @@ -264,6 +265,7 @@ class FBod(_Rex): class FBodRequest(_Rex): code = "bq" help = "Request body" + flags = re.DOTALL @only(HTTPFlow, TCPFlow) def __call__(self, f): @@ -280,6 +282,7 @@ class FBodRequest(_Rex): class FBodResponse(_Rex): code = "bs" help = "Response body" + flags = re.DOTALL @only(HTTPFlow, TCPFlow) def __call__(self, f):