diff --git a/.gitignore b/.gitignore index f268eff1c..be6c965df 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ MANIFEST /dist /tmp /doc +/venv *.py[cdo] *.swp *.swo diff --git a/libmproxy/flow.py b/libmproxy/flow.py index 883c7235a..4fefee9f1 100644 --- a/libmproxy/flow.py +++ b/libmproxy/flow.py @@ -463,7 +463,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).encode('ascii') + return utils.unparse_url(self.scheme, self.host.encode("idna"), self.port, self.path).encode('ascii') def set_url(self, url): """ diff --git a/test/fuzzing/go_proxy b/test/fuzzing/go_proxy new file mode 100755 index 000000000..1e6bbaeff --- /dev/null +++ b/test/fuzzing/go_proxy @@ -0,0 +1,9 @@ +#!/bin/sh +# Assuming: +# mitmproxy/mitmdump is running on port 8080 in straight proxy mode. +# pathod is running on port 9999 + +BASE="/Users/aldo/git/public/pathod/venv/bin/pathoc -eo -I 200,400,502 -p 8080 localhost " +$BASE -n 1000 "get:'http://localhost:9999':ir,@1" + + diff --git a/test/test_fuzzing.py b/test/test_fuzzing.py new file mode 100644 index 000000000..4b4253d87 --- /dev/null +++ b/test/test_fuzzing.py @@ -0,0 +1,12 @@ +import tservers + +""" + A collection of errors turned up by fuzzing. +""" + +class TestFuzzy(tservers.HTTPProxTest): + def test_idna_err(self): + req = r'get:"http://localhost:%s":i10,"\xc6"' + p = self.pathoc() + assert p.request(req%self.server.port).status_code == 400 +