Commit 7844a2f
committed
Merge bitcoin/bitcoin#34772: test: modernize interface_http and cover more libevent behavior
422ca21 test: ensure HTTP server enforces limits on headers and body size (Matthew Zipkin)
0c1a07e test: ensure HTTP server timeout is not caused by a delayed response (Matthew Zipkin)
f06de5c test: clean up and modernize interface_http (Matthew Zipkin)
Pull request description:
This is a follow-up to bitcoin/bitcoin#32408 and a new prerequisite for #32061 in response to a few review comments there.
### New test: `check_server_busy_idle_timeout()`
In bitcoin/bitcoin#32061 (comment) it is pointed out that the idle timeout set by `-rpcservertimeout` could disconnect a client unfairly if it was the server that was taking too long to process a response. That misbehavior was confirmed and #32061 was updated to match current libevent behavior. This PR asserts the current libevent behavior by adding another test using RPC `waitforblock` past the `-rpcservertimeout` value and then verifying that the HTTP connection is still open.
### Expanded tests: `check_excessive_request_size()` and `check_chunked_transfer()`
bitcoin/bitcoin#32061 (comment) made me realize that I was not testing HTTPRequest body size at all, and that headers size was being tested one line at a time but not in total. The libevent server does both things so that behavior is asserted in these expanded tests, and the mechanism in #32061 was improved to match.
### Clean up `interface_http.py`
Since I am extending this test module again I refactored the monolithic test to resemble the current functional test style in the repository, de-duplicating HTTP connection code with a helper class and separating individual test cases into functions.
ACKs for top commit:
fjahr:
ACK 422ca21
Bortlesboat:
re-ACK 422ca21. Checked out the rebased branch and ran interface_http.py locally, passes clean. Went through all three commits -- the helper class deduplication reads well and check_server_busy_idle_timeout is a nice addition from the #32061 discussion. One minor note inline.
hodlinator:
Concept ACK 422ca21
theStack:
ACK 422ca21
Tree-SHA512: 1165c9c49c8b1ae5a40a15e1d0f8275bb4d5e08a5eea7ae8b9d900bb34a85b29ba89c728b5e0866fbf289dd49aa5ece0af63e410e64aee70c89a19759c5ea3ff1 file changed
+299
-165
lines changed
0 commit comments