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:
Matthew Zipkin
2025-04-02 15:46:46 -04:00
parent 5b8046a6e8
commit f16c8c67bf
3 changed files with 139 additions and 0 deletions

View File

@@ -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()