aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/flow.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/flow.py')
-rw-r--r--libmproxy/flow.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/libmproxy/flow.py b/libmproxy/flow.py
index 13b5acbc..d174b41f 100644
--- a/libmproxy/flow.py
+++ b/libmproxy/flow.py
@@ -323,6 +323,18 @@ class Flow:
self.response.ack()
self.intercepting = False
+ def replace(self, pattern, repl, count=0, flags=0):
+ """
+ Replaces a regular expression pattern with repl in all parts of the
+ flow . Returns the number of replacements made.
+ """
+ c = self.request.replace(pattern, repl, count, flags)
+ if self.response:
+ c += self.response.replace(pattern, repl, count, flags)
+ if self.error:
+ c += self.error.replace(pattern, repl, count, flags)
+ return c
+
class State:
def __init__(self):