Re: Any way to set connect-timeout per-IP, not global?

2024-10-11 Thread Dan Fandrich via curl-users
On Fri, Oct 11, 2024 at 06:47:09PM +0300, ValdikSS via curl-users wrote:
> Currently curl, when used with --connect-timeout option, uses it as a global 
> timeout for the whole
> connection set, decreasing the timeout for each IP address in half every 
> connection attempt.
> 
> If several IP addresses from the top of DNS resolution are not working, the 
> others (potentially
> working ones) just won't get enough timeout to establish the connection.

Why set a --connect-timeout shorter than what you're willing to accept? If you
don't mind if the connect takes longer because it has to check more addresses,
just set a longer connect timeout.

Dan
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html


Re: Any way to set connect-timeout per-IP, not global?

2024-10-11 Thread Daniel Stenberg via curl-users

On Fri, 11 Oct 2024, ValdikSS via curl-users wrote:

Currently curl, when used with --connect-timeout option, uses it as a global 
timeout for the whole connection set, decreasing the timeout for each IP 
address in half every connection attempt.


When you use curl 8.3.0 or later, curl stops the timeout halving when there is 
less than 600 milliseconds left.


--

 / daniel.haxx.se
 | Commercial curl support up to 24x7 is available!
 | Private help, bug fixes, support, ports, new features
 | https://curl.se/support.html
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html


Any way to set connect-timeout per-IP, not global?

2024-10-11 Thread ValdikSS via curl-users

Hello list,

Currently curl, when used with --connect-timeout option, uses it as a 
global timeout for the whole connection set, decreasing the timeout for 
each IP address in half every connection attempt.


If several IP addresses from the top of DNS resolution are not working, 
the others (potentially working ones) just won't get enough timeout to 
establish the connection.


Take a look:

$ dig +short proxy-ssl.antizapret.prostovpn.org | xargs echo
51.77.61.44 51.38.124.100 51.89.143.227 46.105.53.114 51.77.61.42 
141.95.37.139 46.105.53.157 46.105.53.63 51.77.61.38 51.15.64.69 
46.105.53.150


$ curl --connect-timeout 5 https://proxy-ssl.antizapret.prostovpn.org 
--interface lo -v

* processing: https://proxy-ssl.antizapret.prostovpn.org
*   Trying 51.77.61.42:443...
* ipv4 connect timeout after 2499ms, move on!
*   Trying 51.77.61.44:443...
* ipv4 connect timeout after 1250ms, move on!
*   Trying 46.105.53.63:443...
* ipv4 connect timeout after 624ms, move on!
*   Trying 51.15.64.69:443...
* ipv4 connect timeout after 312ms, move on!
*   Trying 51.89.143.227:443...
* ipv4 connect timeout after 155ms, move on!
*   Trying 46.105.53.150:443...
* ipv4 connect timeout after 77ms, move on!
*   Trying 46.105.53.114:443...
* ipv4 connect timeout after 38ms, move on!
*   Trying 46.105.53.157:443...
* ipv4 connect timeout after 19ms, move on!
*   Trying 141.95.37.139:443...
* ipv4 connect timeout after 9ms, move on!
*   Trying 51.38.124.100:443...
* ipv4 connect timeout after 5ms, move on!
*   Trying 51.77.61.38:443...
* ipv4 connect timeout after 4ms, move on!
* Failed to connect to proxy-ssl.antizapret.prostovpn.org port 443 after 
5000 ms: Timeout was reached

* Closing connection
curl: (28) Failed to connect to proxy-ssl.antizapret.prostovpn.org port 
443 after 5000 ms: Timeout was reached




This applies to both curl CLI and libcurl, --max-time / CURLOPT_TIMEOUT 
does not change the behavior of connection timeout.


Is there any way to change this behavior, to make connect-timeout to 
apply for each IP address individually?


Thanks.


OpenPGP_signature.asc
Description: OpenPGP digital signature
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html