mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
Unwind twisty maze of cache layers. Holy confusing, Batman.
This commit is contained in:
parent
842e23d3e3
commit
6fb661dab5
@ -129,17 +129,11 @@ class FlowView(urwid.WidgetWrap):
|
|||||||
else:
|
else:
|
||||||
self.view_request()
|
self.view_request()
|
||||||
|
|
||||||
def _cached_content_view(self, viewmode, hdrItems, content, limit, is_request):
|
|
||||||
return contentview.get_content_view(
|
|
||||||
viewmode,
|
|
||||||
hdrItems,
|
|
||||||
content,
|
|
||||||
limit,
|
|
||||||
self.master.add_event,
|
|
||||||
is_request
|
|
||||||
)
|
|
||||||
|
|
||||||
def content_view(self, viewmode, conn):
|
def content_view(self, viewmode, conn):
|
||||||
|
if conn.content == CONTENT_MISSING:
|
||||||
|
msg, body = "", [urwid.Text([("error", "[content missing]")])]
|
||||||
|
return (msg, body)
|
||||||
|
else:
|
||||||
full = self.state.get_flow_setting(
|
full = self.state.get_flow_setting(
|
||||||
self.flow,
|
self.flow,
|
||||||
(self.state.view_flow_mode, "fullcontents"),
|
(self.state.view_flow_mode, "fullcontents"),
|
||||||
@ -150,23 +144,16 @@ class FlowView(urwid.WidgetWrap):
|
|||||||
else:
|
else:
|
||||||
limit = contentview.VIEW_CUTOFF
|
limit = contentview.VIEW_CUTOFF
|
||||||
description, text_objects = cache.get(
|
description, text_objects = cache.get(
|
||||||
self._cached_content_view,
|
contentview.get_content_view,
|
||||||
viewmode,
|
viewmode,
|
||||||
tuple(tuple(i) for i in conn.headers.lst),
|
tuple(tuple(i) for i in conn.headers.lst),
|
||||||
conn.content,
|
conn.content,
|
||||||
limit,
|
limit,
|
||||||
|
self.master.add_event,
|
||||||
isinstance(conn, HTTPRequest)
|
isinstance(conn, HTTPRequest)
|
||||||
)
|
)
|
||||||
return (description, text_objects)
|
return (description, text_objects)
|
||||||
|
|
||||||
def cont_view_handle_missing(self, conn, viewmode):
|
|
||||||
if conn.content == CONTENT_MISSING:
|
|
||||||
msg, body = "", [urwid.Text([("error", "[content missing]")])]
|
|
||||||
else:
|
|
||||||
msg, body = self.content_view(viewmode, conn)
|
|
||||||
|
|
||||||
return (msg, body)
|
|
||||||
|
|
||||||
def viewmode_get(self, override):
|
def viewmode_get(self, override):
|
||||||
return self.state.default_body_view if override is None else override
|
return self.state.default_body_view if override is None else override
|
||||||
|
|
||||||
@ -186,7 +173,7 @@ class FlowView(urwid.WidgetWrap):
|
|||||||
)
|
)
|
||||||
override = self.override_get()
|
override = self.override_get()
|
||||||
viewmode = self.viewmode_get(override)
|
viewmode = self.viewmode_get(override)
|
||||||
msg, body = self.cont_view_handle_missing(conn, viewmode)
|
msg, body = self.content_view(viewmode, conn)
|
||||||
return headers, msg, body
|
return headers, msg, body
|
||||||
|
|
||||||
def conn_text_merge(self, headers, msg, body):
|
def conn_text_merge(self, headers, msg, body):
|
||||||
|
Loading…
Reference in New Issue
Block a user