Timeout not taking in consideration TimeoutConnect
alvarocabanas opened this issue · comments
When setting the timeout on a newly build client, when using the general timeout for the request, judging for the comment here I expected the timeout to be triggered in any case (including DNS resolution, connection time, redirects, and reading the response body) but this timeout is not being triggered when the socket can't connect, and it forces us to always have to set :
timeout_connect(Duration::from_secs(5))
I created this test to prove it: https://github.com/alvarocabanas/ureq/blob/main/tests/http-agent.rs
Is this expected behavior?
Is this expected behavior?
Yes, since the doc you refered to yourself ended with the following paragraph:
This takes precedence over
.timeout_read()
and.timeout_write()
, but not.timeout_connect()
.
However, I agree that it is confusing and I've made this mistake myself. I wish it did not behave this way.
Sadly for now we're stuck with this. I've added it to the FUTURE.md of fixes I want to make on a big version.