mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
test: cover "chunked" Transfer-Encoding
This commit is contained in:
parent
5ec06529bb
commit
f259121f30
1 changed files with 23 additions and 0 deletions
|
@ -156,6 +156,29 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||||
assert chunks[2].startswith(bytes(f'{tip_height + 1}', 'utf8'))
|
assert chunks[2].startswith(bytes(f'{tip_height + 1}', 'utf8'))
|
||||||
|
|
||||||
|
|
||||||
|
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.log.info("Check -rpcservertimeout")
|
||||||
# The test framework typically reuses a single persistent HTTP connection
|
# The test framework typically reuses a single persistent HTTP connection
|
||||||
# for all RPCs to a TestNode. Because we are setting -rpcservertimeout
|
# for all RPCs to a TestNode. Because we are setting -rpcservertimeout
|
||||||
|
|
Loading…
Add table
Reference in a new issue