mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-28 16:36:04 +01:00
tests: Expand HTTP coverage to assert libevent behavior
Covers: - http pipelining - rpcservertimeout Testing this requires adding an option to TestNode to force the test framework to establish a new HTTP connection for every RPC. Otherwise, attempting to reuse a persistent connection would cause framework RPCs during startup and shutdown to fail. - "chunked" Transfer-Encoding
This commit is contained in:
@@ -75,6 +75,7 @@ class AuthServiceProxy():
|
||||
self.__service_url = service_url
|
||||
self._service_name = service_name
|
||||
self.ensure_ascii = ensure_ascii # can be toggled on the fly by tests
|
||||
self.reuse_http_connections = True
|
||||
self.__url = urllib.parse.urlparse(service_url)
|
||||
user = None if self.__url.username is None else self.__url.username.encode('utf8')
|
||||
passwd = None if self.__url.password is None else self.__url.password.encode('utf8')
|
||||
@@ -92,6 +93,8 @@ class AuthServiceProxy():
|
||||
raise AttributeError
|
||||
if self._service_name is not None:
|
||||
name = "%s.%s" % (self._service_name, name)
|
||||
if not self.reuse_http_connections:
|
||||
self._set_conn()
|
||||
return AuthServiceProxy(self.__service_url, name, connection=self.__conn)
|
||||
|
||||
def _request(self, method, path, postdata):
|
||||
@@ -102,6 +105,8 @@ class AuthServiceProxy():
|
||||
'User-Agent': USER_AGENT,
|
||||
'Authorization': self.__auth_header,
|
||||
'Content-type': 'application/json'}
|
||||
if not self.reuse_http_connections:
|
||||
self._set_conn()
|
||||
self.__conn.request(method, path, postdata, headers)
|
||||
return self._get_response()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user