Removes last_encoding attribute from Response. Prompts for encoding on identity responses
This commit is contained in:
parent
74d8b18408
commit
9c24401b18
|
@ -533,23 +533,39 @@ class ConnectionView(WWrap):
|
|||
elif key == "z":
|
||||
if self.state.view_flow_mode == VIEW_FLOW_RESPONSE:
|
||||
conn = self.flow.response
|
||||
e = conn.headers["content-encoding"]
|
||||
if e:
|
||||
if conn.last_encoding:
|
||||
conn.content = encoding.encode(
|
||||
conn.last_encoding,
|
||||
encoding.decode(e[0], conn.content)
|
||||
)
|
||||
conn.last_encoding, conn.headers["content-encoding"] = e[0], [conn.last_encoding]
|
||||
else:
|
||||
conn.last_encoding = "identity"
|
||||
self.master.refresh_connection(self.flow)
|
||||
e = conn.headers["content-encoding"] or ["identity"]
|
||||
if e[0] != "identity":
|
||||
conn.content = encoding.decode(e[0], conn.content)
|
||||
conn.headers["content-encoding"] = ["identity"]
|
||||
else:
|
||||
self.master.prompt_onekey(
|
||||
"Select encoding: ",
|
||||
(
|
||||
("gzip", "z"),
|
||||
("deflate", "d"),
|
||||
),
|
||||
self.encode_response_callback
|
||||
)
|
||||
self.master.refresh_connection(self.flow)
|
||||
return key
|
||||
|
||||
def run_script(self, path):
|
||||
if path:
|
||||
self.master._runscript(self.flow, path)
|
||||
|
||||
def encode_response_callback(self, key):
|
||||
conn = self.flow.response
|
||||
encoding_map = {
|
||||
"z": "gzip",
|
||||
"d": "deflate",
|
||||
}
|
||||
conn.content = encoding.encode(
|
||||
encoding_map[key],
|
||||
conn.content
|
||||
)
|
||||
conn.headers["content-encoding"] = [encoding_map[key]]
|
||||
self.master.refresh_connection(self.flow)
|
||||
|
||||
|
||||
class _PathCompleter:
|
||||
def __init__(self, _testing=False):
|
||||
|
|
|
@ -290,7 +290,6 @@ class Response(controller.Msg):
|
|||
self.timestamp = timestamp or utils.timestamp()
|
||||
controller.Msg.__init__(self)
|
||||
self.replay = False
|
||||
self.last_encoding = None
|
||||
|
||||
def _refresh_cookie(self, c, delta):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue