What parameter causes curl to restore infinite time?

I am using curl to upload files to a remote server. If I added to the rule on the remote server iptables

to deny access from the client, I want the client to keep trying to connect to the remote server. After enabling verbose mode, I see that after the 3rd time of upload time, curl won't retry for 4th time to connect to the remote server Why is this and how can I change it? Is there an option for this in curl_easy_setopt

?

0


source to share


2 answers


This happens automatically, curl

will try to reconnect every time the requested operation timed out. Add something like curl_easy_setopt(m_curl, CURLOPT_TIMEOUT, 5L)

to add a timeout parameter. The problem I was reporting was actually a bug in my code.



0


source


This is from the curl man page. Forgive me if I didn't understand.



--retry <num>
          If a transient error is returned when curl tries  to  perform  a
          transfer,  it  will retry this number of times before giving up.
          Setting the number to 0 makes curl do no retries (which  is  the
          default).  Transient  error  means either: a timeout, an FTP 4xx
          response code or an HTTP 5xx response code.

          When curl is about to retry a transfer, it will first  wait  one
          second  and  then for all forthcoming retries it will double the
          waiting time until it reaches 10 minutes which then will be  the
          delay  between  the rest of the retries.  By using --retry-delay
          you  disable  this  exponential  backoff  algorithm.  See   also
          --retry-max-time  to  limit  the total time allowed for retries.
          (Added in 7.12.3)

          If this option is used several times, the last one will be used.

   --retry-delay <seconds>
          Make curl sleep this amount of time before  each  retry  when  a
          transfer  has  failed  with  a  transient  error (it changes the
          default backoff time algorithm between retries). This option  is
          only  interesting if --retry is also used. Setting this delay to
          zero will make curl use the default  backoff  time.   (Added  in
          7.12.3)

          If this option is used several times, the last one will be used.

   --retry-max-time <seconds>
          The  retry  timer  is  reset  before the first transfer attempt.
          Retries will be done as usual (see --retry) as long as the timer
          hasn't reached this given limit. Notice that if the timer hasn't
          reached the limit, the request will be made and  while  perform‐
          ing,  it may take longer than this given time period. To limit a
          single request´s maximum time, use  -m,  --max-time.   Set  this
          option to zero to not timeout retries. (Added in 7.12.3)

      

0


source







All Articles