(self)
| 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): |
no test coverage detected