Refresh current connection when toggling autodecode.

Also fix the unit tests I forgot to commit...
This commit is contained in:
Aldo Cortesi 2011-08-02 20:47:53 +12:00
parent 8cc0469ee7
commit a817db5bd6
3 changed files with 6 additions and 6 deletions

View File

@ -1728,6 +1728,7 @@ class ConsoleMaster(flow.FlowMaster):
self.anticomp = not self.anticomp self.anticomp = not self.anticomp
elif a == "d": elif a == "d":
self.autodecode = not self.autodecode self.autodecode = not self.autodecode
self.refresh_connection(self.currentflow)
elif a == "k": elif a == "k":
self.killextra = not self.killextra self.killextra = not self.killextra
elif a == "n": elif a == "n":

View File

@ -10,8 +10,7 @@ class uidentity(libpry.AutoTree):
assert "string" == encoding.encode("identity", "string") assert "string" == encoding.encode("identity", "string")
def test_fallthrough(self): def test_fallthrough(self):
assert "string" == encoding.decode("nonexistent encoding", "string") assert None == encoding.decode("nonexistent encoding", "string")
assert "string" == encoding.encode("nonexistent encoding", "string")
class ugzip(libpry.AutoTree): class ugzip(libpry.AutoTree):
def test_simple(self): def test_simple(self):

View File

@ -143,7 +143,7 @@ class uRequest(libpry.AutoTree):
r.headers["content-encoding"] = ["identity"] r.headers["content-encoding"] = ["identity"]
r.content = "falafel" r.content = "falafel"
r.decode() r.decode()
assert r.headers["content-encoding"] == ["identity"] assert not r.headers["content-encoding"]
assert r.content == "falafel" assert r.content == "falafel"
r = tutils.treq() r = tutils.treq()
@ -160,7 +160,7 @@ class uRequest(libpry.AutoTree):
assert r.headers["content-encoding"] == ["gzip"] assert r.headers["content-encoding"] == ["gzip"]
assert r.content != "falafel" assert r.content != "falafel"
r.decode() r.decode()
assert r.headers["content-encoding"] == ["identity"] assert not r.headers["content-encoding"]
assert r.content == "falafel" assert r.content == "falafel"
@ -233,7 +233,7 @@ class uResponse(libpry.AutoTree):
r.headers["content-encoding"] = ["identity"] r.headers["content-encoding"] = ["identity"]
r.content = "falafel" r.content = "falafel"
r.decode() r.decode()
assert r.headers["content-encoding"] == ["identity"] assert not r.headers["content-encoding"]
assert r.content == "falafel" assert r.content == "falafel"
r = tutils.tresp() r = tutils.tresp()
@ -250,7 +250,7 @@ class uResponse(libpry.AutoTree):
assert r.headers["content-encoding"] == ["gzip"] assert r.headers["content-encoding"] == ["gzip"]
assert r.content != "falafel" assert r.content != "falafel"
r.decode() r.decode()
assert r.headers["content-encoding"] == ["identity"] assert not r.headers["content-encoding"]
assert r.content == "falafel" assert r.content == "falafel"