aboutsummaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-10-20 11:35:10 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-10-20 14:31:40 +0200
commit41db8c4733b34d56834162c4d054823c240ffc92 (patch)
tree07b3417f8fc0ff7760be7534a6df349f951b5529 /qa
parentda7d57fb9501ad8939a2923f2a60fa540eae8cfa (diff)
http: Restrict maximum size of request line + headers
Prevent memory exhaustion by sending lots of data. Also add a test to `httpbasics.py`. Closes #6425
Diffstat (limited to 'qa')
-rwxr-xr-xqa/rpc-tests/httpbasics.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/qa/rpc-tests/httpbasics.py b/qa/rpc-tests/httpbasics.py
index b66533543d..7888114c54 100755
--- a/qa/rpc-tests/httpbasics.py
+++ b/qa/rpc-tests/httpbasics.py
@@ -97,5 +97,19 @@ class HTTPBasicsTest (BitcoinTestFramework):
assert_equal('"error":null' in out1, True)
assert_equal(conn.sock!=None, True) #connection must be closed because bitcoind should use keep-alive by default
+ # Check excessive request size
+ conn = httplib.HTTPConnection(urlNode2.hostname, urlNode2.port)
+ conn.connect()
+ conn.request('GET', '/' + ('x'*1000), '', headers)
+ out1 = conn.getresponse()
+ assert_equal(out1.status, httplib.NOT_FOUND)
+
+ conn = httplib.HTTPConnection(urlNode2.hostname, urlNode2.port)
+ conn.connect()
+ conn.request('GET', '/' + ('x'*10000), '', headers)
+ out1 = conn.getresponse()
+ assert_equal(out1.status, httplib.BAD_REQUEST)
+
+
if __name__ == '__main__':
HTTPBasicsTest ().main ()