MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / check_idle_timeout

Method check_idle_timeout

test/functional/interface_http.py:348–372  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

346
347
348 def check_idle_timeout(self):
349 self.log.info("Check -rpcservertimeout")
350
351 # This is the amount of time the server will wait for a client to
352 # send a complete request. Test it by sending an incomplete but
353 # so-far otherwise well-formed HTTP request, and never finishing it.
354 self.restart_node(0, extra_args=[f"-rpcservertimeout={RPCSERVERTIMEOUT}"])
355
356 # Copied from http_incomplete_test_() in regress_http.c in libevent.
357 # A complete request would have an additional "\r\n" at the end.
358 bad_http_request = "GET /test1 HTTP/1.1\r\nHost: somehost\r\n"
359 conn = BitcoinHTTPConnection(self.node)
360 conn.send_raw(bad_http_request.encode("ascii"))
361
362 conn.expect_timeout(RPCSERVERTIMEOUT)
363
364 # Sanity check -- complete requests don't timeout waiting for completion
365 good_http_request = "GET /test2 HTTP/1.1\r\nHost: somehost\r\n\r\n"
366 conn.reset_conn()
367 conn.send_raw(good_http_request.encode("ascii"))
368 response = conn.recv_raw()
369 assert response.startswith(b"HTTP/1.1 404 Not Found")
370
371 # Still open
372 assert not conn.sock_closed()
373
374
375 def check_server_busy_idle_timeout(self):

Callers 1

run_testMethod · 0.95

Calls 9

send_rawMethod · 0.95
expect_timeoutMethod · 0.95
reset_connMethod · 0.95
recv_rawMethod · 0.95
sock_closedMethod · 0.95
infoMethod · 0.80
restart_nodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected