Hello,

Ok as I ran a whole bunch of test and in short the following happened:
CURLOPT_URL -> url on internet
CURLOPT_PROXY -> proxy in local environment
CURLOPT_CONNECTTIMEOUT -> 3 seconds

set a firewall to drop packages on proxy -> curl errno 28 (3 seconds)
(error message Connection timed out)

-- enabling proxy, but disable url on internet ---

Set firewall to drop packages on internet url -> curl errno 28 (3 seconds).
(error message Operation timed out)

The point which like to do is that if the first proxy is down, to switch to a 
backup proxy. (can do with CONNECTTIMEOUT 3 seconds). But as it also applies on 
the remote internet url, it can give problems as it sometimes takes longer to 
connect to the remote internet url than 3 seconds. could be 20-25 seconds. But 
that is too long to check if the first proxy is down and to switch to the 
second proxy.

We have a workaround, but wanted to verify if there was somehow a:
CURLOPT_CONNECTTIMEOUT (set 20 seconds)
CURLOPT_CONNECTTIMEOUT_PROXY (set 3 seconds)

Or some other trick...

As the "proxy" connecttimeout should be short in our scenario vs the "internet 
url" connecttimeout.

The CURLOPT_TIMEOUT does not help here, unfortunately. (Did more tests, but 
trying to keep this short and not to post too much data)

Thank you for your replies.
V.



------- Original Message -------

On Friday, March 4th, 2022 at 10:30 PM, Ray Satiro via curl-library 
<curl-library@lists.haxx.se> wrote:

> On 3/4/2022 10:08 AM, vin9999 via curl-library wrote:
>
> > Would like to ask if it is possible to set a different connecttimeout for 
> > the proxy connection vs the actual url connection. Would like to 
> > distinguish between them, in some way.
> >
> > Incase of PHP
> >
> > CURLOPT_URL
> >
> > CURLOPT_PROXY
> >
> > CURLOPT_CONNECTTIMEOUT -> they seem to share the same value.
>
> There is no specific proxy connect timeout. If curl is tunneling through
>
> the connected-to proxy [1] (CONNECTING => TUNNELING phase) then that is
>
> counted as part of the connect timeout. HTTPS transfer over proxy
>
> implies tunneling, HTTP doesn't. If you need the transfer to timeout
>
> review the documentation for CURLOPT_TIMEOUT [2] to see if it's right
>
> for you.
>
> [1]: https://curl.se/libcurl/c/CURLOPT_HTTPPROXYTUNNEL.html
>
> [2]: https://curl.se/libcurl/c/CURLOPT_TIMEOUT.html
>
> --
>
> Unsubscribe: https://lists.haxx.se/listinfo/curl-library
>
> Etiquette: https://curl.haxx.se/mail/etiquette.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to