2016-02-02 12:25:31 +00:00
|
|
|
from . import tservers
|
2013-03-03 01:56:56 +00:00
|
|
|
|
|
|
|
"""
|
2013-03-03 02:14:49 +00:00
|
|
|
A collection of errors turned up by fuzzing. Errors are integrated here
|
|
|
|
after being fixed to check for regressions.
|
2013-03-03 01:56:56 +00:00
|
|
|
"""
|
|
|
|
|
2015-05-30 00:03:28 +00:00
|
|
|
|
2016-02-16 20:15:50 +00:00
|
|
|
class TestFuzzy(tservers.HTTPProxyTest):
|
2016-01-27 09:12:18 +00:00
|
|
|
|
2013-03-03 01:56:56 +00:00
|
|
|
def test_idna_err(self):
|
|
|
|
req = r'get:"http://localhost:%s":i10,"\xc6"'
|
|
|
|
p = self.pathoc()
|
2016-09-09 21:18:11 +00:00
|
|
|
with p.connect():
|
|
|
|
assert p.request(req % self.server.port).status_code == 400
|
2013-03-03 01:56:56 +00:00
|
|
|
|
2013-03-03 02:14:49 +00:00
|
|
|
def test_nullbytes(self):
|
|
|
|
req = r'get:"http://localhost:%s":i19,"\x00"'
|
|
|
|
p = self.pathoc()
|
2016-09-09 21:18:11 +00:00
|
|
|
with p.connect():
|
|
|
|
assert p.request(req % self.server.port).status_code == 400
|
2013-03-03 02:14:49 +00:00
|
|
|
|
|
|
|
def test_invalid_ipv6_url(self):
|
|
|
|
req = 'get:"http://localhost:%s":i13,"["'
|
|
|
|
p = self.pathoc()
|
2016-09-09 21:18:11 +00:00
|
|
|
with p.connect():
|
|
|
|
resp = p.request(req % self.server.port)
|
2015-09-16 16:45:22 +00:00
|
|
|
assert resp.status_code == 400
|
2013-03-03 09:03:27 +00:00
|
|
|
|
2015-07-29 09:39:53 +00:00
|
|
|
# def test_invalid_upstream(self):
|
|
|
|
# req = r"get:'http://localhost:%s/p/200:i10,\x27+\x27'"
|
|
|
|
# p = self.pathoc()
|
|
|
|
# assert p.request(req % self.server.port).status_code == 502
|
|
|
|
|
|
|
|
# def test_upstream_disconnect(self):
|
|
|
|
# req = r'200:d0'
|
|
|
|
# p = self.pathod(req)
|
|
|
|
# assert p.status_code == 502
|