Skip to content

Commit

Permalink
Begin some simple fuzzing with pathod.
Browse files Browse the repository at this point in the history
Finally doing what I started writing pathod for in the first place...
  • Loading branch information
cortesi committed Mar 3, 2013
1 parent e608d10 commit 7835e0c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ MANIFEST
/dist
/tmp
/doc
/venv
*.py[cdo]
*.swp
*.swo
Expand Down
2 changes: 1 addition & 1 deletion libmproxy/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ def get_url(self):
"""
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):
"""
Expand Down
9 changes: 9 additions & 0 deletions test/fuzzing/go_proxy
Original file line number Diff line number Diff line change
@@ -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"


12 changes: 12 additions & 0 deletions test/test_fuzzing.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7835e0c

Please sign in to comment.