mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 11:19:23 +00:00
used get_decoded_content and removed decode call from headers as max suggested
This commit is contained in:
parent
d49eafad8b
commit
6b8fb147d0
@ -141,12 +141,12 @@ class ConnectionItem(common.WWrap):
|
|||||||
def server_copy_response(self, k):
|
def server_copy_response(self, k):
|
||||||
if k == "c":
|
if k == "c":
|
||||||
try:
|
try:
|
||||||
pyperclip.copy(self.flow.response_content())
|
pyperclip.copy(self.flow.response.get_decoded_content())
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.master.statusbar.message("Content is binary or can be converted to text")
|
self.master.statusbar.message("Content is binary or can be converted to text")
|
||||||
elif k == "h":
|
elif k == "h":
|
||||||
try:
|
try:
|
||||||
pyperclip.copy(self.flow.response_headers())
|
pyperclip.copy(str(self.flow.response.headers))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.master.statusbar.message("Error converting headers to text")
|
self.master.statusbar.message("Error converting headers to text")
|
||||||
|
|
||||||
|
@ -652,12 +652,12 @@ class FlowView(common.WWrap):
|
|||||||
def server_copy_response(self, k):
|
def server_copy_response(self, k):
|
||||||
if k == "c":
|
if k == "c":
|
||||||
try:
|
try:
|
||||||
pyperclip.copy(self.flow.response_content())
|
pyperclip.copy(self.flow.response.get_decoded_content())
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.master.statusbar.message("Content is binary or can be converted to text")
|
self.master.statusbar.message("Content is binary or can be converted to text")
|
||||||
elif k == "h":
|
elif k == "h":
|
||||||
try:
|
try:
|
||||||
pyperclip.copy(self.flow.response_headers())
|
pyperclip.copy(str(self.flow.response.headers))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.master.statusbar.message("Error converting headers to text")
|
self.master.statusbar.message("Error converting headers to text")
|
||||||
|
|
||||||
|
@ -953,16 +953,6 @@ class HTTPFlow(Flow):
|
|||||||
c += self.response.replace(pattern, repl, *args, **kwargs)
|
c += self.response.replace(pattern, repl, *args, **kwargs)
|
||||||
return c
|
return c
|
||||||
|
|
||||||
def response_content(self):
|
|
||||||
with decoded(self.response):
|
|
||||||
s = self.response.content
|
|
||||||
return s
|
|
||||||
|
|
||||||
def response_headers(self):
|
|
||||||
with decoded(self.response):
|
|
||||||
s = str(self.response.headers)
|
|
||||||
return s
|
|
||||||
|
|
||||||
class HttpAuthenticationError(Exception):
|
class HttpAuthenticationError(Exception):
|
||||||
def __init__(self, auth_headers=None):
|
def __init__(self, auth_headers=None):
|
||||||
super(HttpAuthenticationError, self).__init__(
|
super(HttpAuthenticationError, self).__init__(
|
||||||
|
Loading…
Reference in New Issue
Block a user