finch icon indicating copy to clipboard operation
finch copied to clipboard

Support for HTTP/2 per-chunk idle receive_timeout and wall clock request_timeout

Open jtsmills opened this issue 7 months ago • 0 comments

Description Finch's HTTP/2 receive_timeout was a one-shot timer at request start. It never reset when data arrived. Streaming responses that took longer than receive_timeout (even with chunks coming in) would get killed. These changes bring it in line with the opts for HTTP/1.

HTTP/1 doesn't have this issue because receive_timeout is passed per Mint.HTTP.recv() call.

This is a breaking change, users who just pass in receive_timeout will have the default request_timeout (infinity) still. This means a user may not receive timeouts as expected.

Changes

  • receive_timeout is now an idle timeout that is reset on every :data chunk in handle_response
  • request_timeout can now be used for a "wall-clock" cap timeout
  • Refactor the timeout request handling for both cases

jtsmills avatar Apr 22 '26 04:04 jtsmills