aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
authorarjun23496 <arjun.k018@gmail.com>2016-08-26 21:23:37 +0530
committerarjun23496 <arjun.k018@gmail.com>2016-08-26 21:26:38 +0530
commit70f94c7171cac9659feccfb0f974f72d4bc33a80 (patch)
treedba04b50265bb99b9150c05b9512e232c37d8554 /netlib
parent6afbfc85266e783b1bad432ae1f6715bfb16a39f (diff)
downloadmitmproxy-70f94c7171cac9659feccfb0f974f72d4bc33a80.tar.gz
mitmproxy-70f94c7171cac9659feccfb0f974f72d4bc33a80.tar.bz2
mitmproxy-70f94c7171cac9659feccfb0f974f72d4bc33a80.zip
Added count argument for replace for contents in body
Diffstat (limited to 'netlib')
-rw-r--r--netlib/http/message.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/netlib/http/message.py b/netlib/http/message.py
index ce92bab1..b84f45c5 100644
--- a/netlib/http/message.py
+++ b/netlib/http/message.py
@@ -260,7 +260,7 @@ class Message(basetypes.Serializable):
if "content-encoding" not in self.headers:
raise ValueError("Invalid content encoding {}".format(repr(e)))
- def replace(self, pattern, repl, flags=0):
+ def replace(self, pattern, repl, flags=0, count=0):
"""
Replaces a regular expression pattern with repl in both the headers
and the body of the message. Encoded body will be decoded
@@ -276,7 +276,7 @@ class Message(basetypes.Serializable):
replacements = 0
if self.content:
self.content, replacements = re.subn(
- pattern, repl, self.content, flags=flags
+ pattern, repl, self.content, flags=flags, count=count
)
replacements += self.headers.replace(pattern, repl, flags)
return replacements