From a817db5bd6b55cfb86de24cf7bc8aa8bb400653d Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 2 Aug 2011 20:47:53 +1200 Subject: [PATCH] Refresh current connection when toggling autodecode. Also fix the unit tests I forgot to commit... --- libmproxy/console.py | 1 + test/test_encoding.py | 3 +-- test/test_proxy.py | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libmproxy/console.py b/libmproxy/console.py index 9b77b9dcf..39fb871f0 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -1728,6 +1728,7 @@ class ConsoleMaster(flow.FlowMaster): self.anticomp = not self.anticomp elif a == "d": self.autodecode = not self.autodecode + self.refresh_connection(self.currentflow) elif a == "k": self.killextra = not self.killextra elif a == "n": diff --git a/test/test_encoding.py b/test/test_encoding.py index dff146ee7..d9e6a85c9 100644 --- a/test/test_encoding.py +++ b/test/test_encoding.py @@ -10,8 +10,7 @@ class uidentity(libpry.AutoTree): assert "string" == encoding.encode("identity", "string") def test_fallthrough(self): - assert "string" == encoding.decode("nonexistent encoding", "string") - assert "string" == encoding.encode("nonexistent encoding", "string") + assert None == encoding.decode("nonexistent encoding", "string") class ugzip(libpry.AutoTree): def test_simple(self): diff --git a/test/test_proxy.py b/test/test_proxy.py index 340a68d7c..83898d115 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -143,7 +143,7 @@ class uRequest(libpry.AutoTree): r.headers["content-encoding"] = ["identity"] r.content = "falafel" r.decode() - assert r.headers["content-encoding"] == ["identity"] + assert not r.headers["content-encoding"] assert r.content == "falafel" r = tutils.treq() @@ -160,7 +160,7 @@ class uRequest(libpry.AutoTree): assert r.headers["content-encoding"] == ["gzip"] assert r.content != "falafel" r.decode() - assert r.headers["content-encoding"] == ["identity"] + assert not r.headers["content-encoding"] assert r.content == "falafel" @@ -233,7 +233,7 @@ class uResponse(libpry.AutoTree): r.headers["content-encoding"] = ["identity"] r.content = "falafel" r.decode() - assert r.headers["content-encoding"] == ["identity"] + assert not r.headers["content-encoding"] assert r.content == "falafel" r = tutils.tresp() @@ -250,7 +250,7 @@ class uResponse(libpry.AutoTree): assert r.headers["content-encoding"] == ["gzip"] assert r.content != "falafel" r.decode() - assert r.headers["content-encoding"] == ["identity"] + assert not r.headers["content-encoding"] assert r.content == "falafel"