mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
backup for flow.decode/encode
This commit is contained in:
parent
8eec21d553
commit
f21979f6ad
@ -164,6 +164,7 @@ class Core:
|
||||
for f in flows:
|
||||
p = getattr(f, part, None)
|
||||
if p:
|
||||
f.backup()
|
||||
p.decode()
|
||||
updated.append(f)
|
||||
ctx.master.addons.trigger("update", updated)
|
||||
@ -205,6 +206,7 @@ class Core:
|
||||
if p:
|
||||
current_enc = p.headers.get("content-encoding", "identity")
|
||||
if current_enc == "identity":
|
||||
f.backup()
|
||||
p.encode(enc)
|
||||
updated.append(f)
|
||||
ctx.master.addons.trigger("update", updated)
|
||||
|
@ -379,11 +379,12 @@ class ConsoleAddon:
|
||||
# but for now it is.
|
||||
if not flow:
|
||||
raise exceptions.CommandError("No flow selected.")
|
||||
flow.backup()
|
||||
|
||||
require_dummy_response = (
|
||||
part in ("response-headers", "response-body", "set-cookies") and
|
||||
flow.response is None
|
||||
)
|
||||
flow.backup()
|
||||
if require_dummy_response:
|
||||
flow.response = http.HTTPResponse.make()
|
||||
if part == "cookies":
|
||||
|
Loading…
Reference in New Issue
Block a user