diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-03-15 14:04:58 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2017-03-15 14:06:00 +0100 |
commit | 65c4a3cf1d3359acfeeb94449b573b7cde650f1c (patch) | |
tree | 2be7774cfca7fee8a297522180dc3ca06f0257bc /mitmproxy/master.py | |
parent | ec5d9cbd2b224d11e0e8df912b19decbd149d1b9 (diff) | |
download | mitmproxy-65c4a3cf1d3359acfeeb94449b573b7cde650f1c.tar.gz mitmproxy-65c4a3cf1d3359acfeeb94449b573b7cde650f1c.tar.bz2 mitmproxy-65c4a3cf1d3359acfeeb94449b573b7cde650f1c.zip |
add Request.make
Diffstat (limited to 'mitmproxy/master.py')
-rw-r--r-- | mitmproxy/master.py | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/mitmproxy/master.py b/mitmproxy/master.py index 79747a97..57d47394 100644 --- a/mitmproxy/master.py +++ b/mitmproxy/master.py @@ -15,7 +15,6 @@ from mitmproxy import log from mitmproxy import io from mitmproxy.proxy.protocol import http_replay from mitmproxy.types import basethread -import mitmproxy.net.http from . import ctx as mitmproxy_ctx @@ -122,27 +121,18 @@ class Master: self.should_exit.set() self.addons.done() - def create_request(self, method, scheme, host, port, path): + def create_request(self, method, url): """ - this method creates a new artificial and minimalist request also adds it to flowlist + Create a new artificial and minimalist request also adds it to flowlist. + + Raises: + ValueError, if the url is malformed. """ + req = http.HTTPRequest.make(method, url) c = connections.ClientConnection.make_dummy(("", 0)) - s = connections.ServerConnection.make_dummy((host, port)) + s = connections.ServerConnection.make_dummy((req.host, req.port)) f = http.HTTPFlow(c, s) - headers = mitmproxy.net.http.Headers() - - req = http.HTTPRequest( - "absolute", - method, - scheme, - host, - port, - path, - b"HTTP/1.1", - headers, - b"" - ) f.request = req self.load_flow(f) return f |