mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-20 11:49:07 +02:00
Compare to None with is/is not
This commit is contained in:
@@ -31,13 +31,13 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read()
|
||||
assert(b'"error":null' in out1)
|
||||
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
|
||||
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
|
||||
|
||||
#send 2nd request without closing connection
|
||||
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
|
||||
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!
|
||||
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
|
||||
conn.close()
|
||||
|
||||
#same should be if we add keep-alive because this should be the std. behaviour
|
||||
@@ -48,13 +48,13 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read()
|
||||
assert(b'"error":null' in out1)
|
||||
assert(conn.sock!=None) #according to http/1.1 connection must still be open!
|
||||
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
|
||||
|
||||
#send 2nd request without closing connection
|
||||
conn.request('POST', '/', '{"method": "getchaintips"}', headers)
|
||||
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!
|
||||
assert(conn.sock is not None) #according to http/1.1 connection must still be open!
|
||||
conn.close()
|
||||
|
||||
#now do the same with "Connection: close"
|
||||
@@ -65,7 +65,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read()
|
||||
assert(b'"error":null' in out1)
|
||||
assert(conn.sock==None) #now the connection must be closed after the response
|
||||
assert(conn.sock is None) #now the connection must be closed after the response
|
||||
|
||||
#node1 (2nd node) is running with disabled keep-alive option
|
||||
urlNode1 = urllib.parse.urlparse(self.nodes[1].url)
|
||||
@@ -88,7 +88,7 @@ class HTTPBasicsTest (BitcoinTestFramework):
|
||||
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
|
||||
out1 = conn.getresponse().read()
|
||||
assert(b'"error":null' in out1)
|
||||
assert(conn.sock!=None) #connection must be closed because bitcoind should use keep-alive by default
|
||||
assert(conn.sock is not None) #connection must be closed because bitcoind should use keep-alive by default
|
||||
|
||||
# Check excessive request size
|
||||
conn = http.client.HTTPConnection(urlNode2.hostname, urlNode2.port)
|
||||
|
||||
Reference in New Issue
Block a user