diff --git a/libmproxy/console.py b/libmproxy/console.py index 93848d04c..e6810d4b6 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -920,7 +920,6 @@ class ConsoleMaster(flow.FlowMaster): self.debug = options.debug - def _runscript(self, f, path): path = os.path.expanduser(path) self.state.last_script = path diff --git a/libmproxy/proxy.py b/libmproxy/proxy.py index c5e5971ac..5051492cf 100644 --- a/libmproxy/proxy.py +++ b/libmproxy/proxy.py @@ -287,6 +287,8 @@ class Request(controller.Msg): made. """ self.content, c = re.subn(pattern, repl, self.content, count, flags) + self.path, pc = re.subn(pattern, repl, self.path, count, flags) + c += pc c += self.headers.replace(pattern, repl, count, flags) return c diff --git a/test/test_proxy.py b/test/test_proxy.py index a7627c1bc..dacdbcc3d 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -130,9 +130,11 @@ class uRequest(libpry.AutoTree): def test_replace(self): r = tutils.treq() + r.path = "path/foo" r.headers["Foo"] = ["fOo"] r.content = "afoob" - assert r.replace("foo", "boo", flags=re.I) == 3 + assert r.replace("foo", "boo", flags=re.I) == 4 + assert r.path == "path/boo" assert not "foo" in r.content assert r.headers["boo"] == ["boo"]