diff options
Diffstat (limited to 'libmproxy')
-rw-r--r-- | libmproxy/console/grideditor.py | 12 | ||||
-rw-r--r-- | libmproxy/flow.py | 2 |
2 files changed, 12 insertions, 2 deletions
diff --git a/libmproxy/console/grideditor.py b/libmproxy/console/grideditor.py index 371c8c57..51002e77 100644 --- a/libmproxy/console/grideditor.py +++ b/libmproxy/console/grideditor.py @@ -229,6 +229,10 @@ class GridListBox(urwid.ListBox): FIRST_WIDTH_MAX = 40 FIRST_WIDTH_MIN = 20 class GridEditor(common.WWrap): + title = None + columns = None + headings = None + encoding = None def __init__(self, master, value, callback, *cb_args, **cb_kwargs): value = copy.deepcopy(value) self.master, self.value, self.callback = master, value, callback @@ -299,7 +303,10 @@ class GridEditor(common.WWrap): res = [] for i in self.walker.lst: if any([x.strip() for x in i[0]]): - res.append(i[0]) + v = i[0] + if self.encoding: + v = [x.encode(self.encoding) for x in v] + res.append(v) self.callback(res, *self.cb_args, **self.cb_kwargs) self.master.pop_view() elif key in ["h", "left"]: @@ -334,18 +341,21 @@ class QueryEditor(GridEditor): title = "Editing query" columns = 2 headings = ("Key", "Value") + encoding = "ascii" class HeaderEditor(GridEditor): title = "Editing headers" columns = 2 headings = ("Key", "Value") + encoding = "ascii" class URLEncodedFormEditor(GridEditor): title = "Editing URL-encoded form" columns = 2 headings = ("Key", "Value") + encoding = "ascii" class ReplaceEditor(GridEditor): diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 59df04b2..dd43a24f 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -359,7 +359,7 @@ class Request(HTTPMsg): """ Returns a URL string, constructed from the Request's URL compnents. """ - return utils.unparse_url(self.scheme, self.host.decode("idna"), self.port, self.path) + return utils.unparse_url(self.scheme, self.host.decode("idna"), self.port, self.path).encode('ascii') def set_url(self, url): """ |