Skip to content

Commit

Permalink
Merge #7802: [qa] httpbasics: Actually test second connection
Browse files Browse the repository at this point in the history
fa24456 [qa] httpbasics: Actually test second connection (MarcoFalke)
  • Loading branch information
laanwj committed Apr 6, 2016
2 parents 401c65c + fa24456 commit 3bc71e1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions qa/rpc-tests/httpbasics.py
Expand Up @@ -37,13 +37,13 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock!=None) #according to http/1.1 connection must still be open!

#send 2nd request without closing connection
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
out2 = conn.getresponse().read()
assert('"error":null' in out1) #must also response with a correct json-rpc message
out1 = conn.getresponse().read()
assert(b'"error":null' in out1) #must also response with a correct json-rpc message
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
conn.close()

Expand All @@ -54,13 +54,13 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock!=None) #according to http/1.1 connection must still be open!

#send 2nd request without closing connection
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
out2 = conn.getresponse().read()
assert('"error":null' in out1) #must also response with a correct json-rpc message
out1 = conn.getresponse().read()
assert(b'"error":null' in out1) #must also response with a correct json-rpc message
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
conn.close()

Expand All @@ -71,7 +71,7 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock==None) #now the connection must be closed after the response

#node1 (2nd node) is running with disabled keep-alive option
Expand All @@ -83,7 +83,7 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)

#node2 (third node) is running with standard keep-alive parameters which means keep-alive is on
urlNode2 = urlparse.urlparse(self.nodes[2].url)
Expand All @@ -94,7 +94,7 @@ def run_test(self):
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
out1 = conn.getresponse().read()
assert('"error":null' in out1)
assert(b'"error":null' in out1)
assert(conn.sock!=None) #connection must be closed because bitcoind should use keep-alive by default

# Check excessive request size
Expand Down

0 comments on commit 3bc71e1

Please sign in to comment.