finch
finch copied to clipboard
Support for HTTP/2 per-chunk idle receive_timeout and wall clock request_timeout
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_timeoutis now an idle timeout that is reset on every:datachunk inhandle_responserequest_timeoutcan now be used for a "wall-clock" cap timeout- Refactor the timeout request handling for both cases