mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-07 19:48:58 +02:00
test: cover "chunked" Transfer-Encoding
This commit is contained in:
parent
4ccc28f8c3
commit
3fa1408958
@ -105,6 +105,28 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
out1 = conn.getresponse()
|
||||
assert_equal(out1.status, http.client.BAD_REQUEST)
|
||||
|
||||
self.log.info("Check HTTP request encoded with chunked transfer")
|
||||
headers_chunked = headers.copy()
|
||||
headers_chunked.update({"Transfer-encoding": "chunked"})
|
||||
body_chunked = [
|
||||
b'{"method": "submitblock", "params": ["',
|
||||
b'0A' * 1000000,
|
||||
b'0B' * 1000000,
|
||||
b'0C' * 1000000,
|
||||
b'0D' * 1000000,
|
||||
b'"]}'
|
||||
]
|
||||
conn = http.client.HTTPConnection(urlNode2.hostname, urlNode2.port)
|
||||
conn.connect()
|
||||
conn.request(
|
||||
method='POST',
|
||||
url='/',
|
||||
body=iter(body_chunked),
|
||||
headers=headers_chunked,
|
||||
encode_chunked=True)
|
||||
out1 = conn.getresponse().read()
|
||||
assert out1 == b'{"result":"high-hash","error":null}\n'
|
||||
|
||||
self.log.info("Check -rpcservertimeout")
|
||||
self.restart_node(2, extra_args=["-rpcservertimeout=1"])
|
||||
# This is the amount of time the server will wait for a client to
|
||||
|
Loading…
x
Reference in New Issue
Block a user