diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py index 0106e0758..1d1d1e7b1 100644 --- a/libmproxy/console/flowview.py +++ b/libmproxy/console/flowview.py @@ -317,6 +317,9 @@ class FlowView(common.WWrap): def set_query(self, lst, conn): conn.set_query(flow.ODict(lst)) + def set_path_components(self, lst, conn): + conn.set_path_components([i[0] for i in lst]) + def set_form(self, lst, conn): conn.set_form_urlencoded(flow.ODict(lst)) @@ -356,6 +359,10 @@ class FlowView(common.WWrap): self.edit_form(conn) elif part == "h": self.master.view_grideditor(grideditor.HeaderEditor(self.master, conn.headers.lst, self.set_headers, conn)) + elif part == "p": + p = conn.get_path_components() + p = [[i] for i in p] + self.master.view_grideditor(grideditor.PathEditor(self.master, p, self.set_path_components, conn)) elif part == "q": self.master.view_grideditor(grideditor.QueryEditor(self.master, conn.get_query().lst, self.set_query, conn)) elif part == "u" and self.state.view_flow_mode == common.VIEW_FLOW_REQUEST: @@ -470,9 +477,10 @@ class FlowView(common.WWrap): "Edit request", ( ("query", "q"), - ("form", "f"), + ("path", "p"), ("url", "u"), ("header", "h"), + ("form", "f"), ("raw body", "r"), ("method", "m"), ), diff --git a/libmproxy/console/grideditor.py b/libmproxy/console/grideditor.py index d62cb2067..138ca12e0 100644 --- a/libmproxy/console/grideditor.py +++ b/libmproxy/console/grideditor.py @@ -95,7 +95,8 @@ class GridRow(common.WWrap): ) fspecs = self.fields[:] - fspecs[0] = ("fixed", self.editor.first_width + 2, fspecs[0]) + if len(self.fields) > 1: + fspecs[0] = ("fixed", self.editor.first_width + 2, fspecs[0]) w = urwid.Columns( fspecs, dividechars = 2 @@ -252,7 +253,7 @@ class GridEditor(common.WWrap): headings = [] for i, h in enumerate(self.headings): c = urwid.Text(h) - if i == 0: + if i == 0 and len(self.headings) > 1: headings.append(("fixed", first_width + 2, c)) else: headings.append(c) @@ -384,3 +385,10 @@ class SetHeadersEditor(GridEditor): return True return False + +class PathEditor(GridEditor): + title = "Editing URL path components" + columns = 1 + headings = ("Component",) + encoding = "ascii" +