From 3b246f7e278c485a98a5c3b37a21c82b18fd1fee Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 26 Oct 2011 14:49:15 +1300 Subject: [PATCH] Simple fix for a unicode error when editing a request URL. --- libmproxy/console.py | 2 +- libmproxy/flow.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libmproxy/console.py b/libmproxy/console.py index d090314fb..337cd243b 100644 --- a/libmproxy/console.py +++ b/libmproxy/console.py @@ -426,7 +426,7 @@ class ConnectionView(WWrap): def set_url(self, url): request = self.flow.request - if not request.set_url(url): + if not request.set_url(str(url)): return "Invalid URL." self.master.refresh_connection(self.flow) diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 63e6835eb..6e27211d0 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -21,8 +21,8 @@ class ScriptContext: def log(self, *args, **kwargs): """ - Logs an event. - + Logs an event. + How this is handled depends on the front-end. mitmdump will display events if the eventlog flag ("-e") was passed. mitmproxy sends output to the eventlog for display ("v" keyboard shortcut). @@ -184,18 +184,18 @@ class Request(HTTPMsg): An HTTP request. Exposes the following attributes: - + client_conn: ClientConnection object, or None if this is a replay. headers: Headers object content: Content of the request, or None - + scheme: URL scheme (http/https) host: Host portion of the URL port: Destination port path: Path portion of the URL timestamp: Seconds since the epoch - method: HTTP method + method: HTTP method """ def __init__(self, client_conn, host, port, scheme, method, path, headers, content, timestamp=None): self.client_conn = client_conn @@ -326,7 +326,7 @@ class Request(HTTPMsg): Parses a URL specification, and updates the Request's information accordingly. - Returns False if the URL was invalid, True if the request succeeded. + Returns False if the URL was invalid, True if the request succeeded. """ parts = utils.parse_url(url) if not parts: @@ -539,7 +539,7 @@ class Response(HTTPMsg): class ClientDisconnect(controller.Msg): """ - A client disconnection event. + A client disconnection event. Exposes the following attributes: @@ -556,7 +556,7 @@ class ClientConnect(controller.Msg): Requests. Exposes the following attributes: - + address: (address, port) tuple, or None if the connection is replayed. requestcount: Number of requests created by this client connection. close: Is the client connection closed? @@ -598,7 +598,7 @@ class ClientConnect(controller.Msg): class Error(controller.Msg): """ - An Error. + An Error. This is distinct from an HTTP error response (say, a code 500), which is represented by a normal Response object. This class is responsible @@ -812,7 +812,7 @@ class Flow: """ A Flow is a collection of objects representing a single HTTP transaction. The main attributes are: - + request: Request object response: Response object error: Error object