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
This commit is contained in:
committed by
lateminer
parent
84a208b9d2
commit
d57bd81ce6
@@ -104,5 +104,19 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
assert_equal(out1.status, http.client.BAD_REQUEST)
|
||||
|
||||
|
||||
# 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 ()
|
||||
|
||||
Reference in New Issue
Block a user