mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
now content and header are working and exception for binary files are handled correctly
This commit is contained in:
parent
34d355a62b
commit
a4bfa677e9
@ -13,6 +13,7 @@ def _mkhelp():
|
|||||||
("D", "duplicate flow"),
|
("D", "duplicate flow"),
|
||||||
("e", "toggle eventlog"),
|
("e", "toggle eventlog"),
|
||||||
("F", "toggle follow flow list"),
|
("F", "toggle follow flow list"),
|
||||||
|
("g", "copy response(content/headers) to clipboard"),
|
||||||
("l", "set limit filter pattern"),
|
("l", "set limit filter pattern"),
|
||||||
("L", "load saved flows"),
|
("L", "load saved flows"),
|
||||||
("r", "replay request"),
|
("r", "replay request"),
|
||||||
@ -139,9 +140,15 @@ class ConnectionItem(common.WWrap):
|
|||||||
)
|
)
|
||||||
def server_copy_response(self, k):
|
def server_copy_response(self, k):
|
||||||
if k == "c":
|
if k == "c":
|
||||||
pyperclip.copy(self.flow.response_content())
|
try:
|
||||||
elif k == "t":
|
pyperclip.copy(self.flow.response_content())
|
||||||
pyperclip.copy(self.flow.response_headers())
|
except TypeError:
|
||||||
|
self.master.statusbar.message("Content is binary or can be converted to text")
|
||||||
|
elif k == "h":
|
||||||
|
try:
|
||||||
|
pyperclip.copy(self.flow.response_headers())
|
||||||
|
except TypeError:
|
||||||
|
self.master.statusbar.message("Error converting headers to text")
|
||||||
|
|
||||||
def keypress(self, (maxcol,), key):
|
def keypress(self, (maxcol,), key):
|
||||||
key = common.shortcuts(key)
|
key = common.shortcuts(key)
|
||||||
|
@ -954,20 +954,18 @@ class HTTPFlow(Flow):
|
|||||||
return c
|
return c
|
||||||
|
|
||||||
def response_content(self):
|
def response_content(self):
|
||||||
s = "[No Content]"
|
|
||||||
with decoded(self.response):
|
with decoded(self.response):
|
||||||
s = self.response.content
|
s = self.response.content
|
||||||
|
if s == None:
|
||||||
|
s = "[No content]"
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def response_headers(self):
|
def response_headers(self):
|
||||||
with decoded(self.response):
|
with decoded(self.response):
|
||||||
sh = ""
|
s = str(self.response.headers)
|
||||||
for i in self.flow.response.headers:
|
if s == None:
|
||||||
v = self.flow.response.headers[i]
|
s = "[]"
|
||||||
for j in v:
|
return s
|
||||||
sh += str(i)+"="+str(v[j])+"\n"
|
|
||||||
return sh
|
|
||||||
|
|
||||||
|
|
||||||
class HttpAuthenticationError(Exception):
|
class HttpAuthenticationError(Exception):
|
||||||
def __init__(self, auth_headers=None):
|
def __init__(self, auth_headers=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user