title: curl ignoring --connect-timeout parameter
body: <p>I am running the following curl command from a Windows batch (in a Jenkins job, for what it's worth):</p>
  <pre><code>C:\&gt;curl --connect-timeout 240 --user &lt;myuser&gt; --header &quot;Content-Type: text/xml;charset=UTF-8&quot; --data @C:\dataOut\myData.xml http://www.myURL.it/myApi.asmx -o C:\dataIn\mtResponse.xml --verbose
  </code></pre>
  <p>When the server is fast enough everything goes right, but occasionally the reply is slow and the connection times out.</p>
  <p>I thought that the <code>--connect-timeout 240</code> parameter would have set the conection timeout to 240 seconds (i.e. 4 minutes), nonetheless the connection seems to timeout after 20 seconds:</p>
  <pre><code>  0     0    0     0    0     0      0      0 --:--:--  0:00:20 --:--:--     0* connect to N.N.N.N port 80 failed: Timed out
  </code></pre>
  <p>The complete output is the following:</p>
  <pre><code>C:\&gt;curl --connect-timeout 240 --user &lt;myuser&gt; --header &quot;Content-Type: text/xml;charset=UTF-8&quot; --data @C:\dataOut\myData.xml http://www.myURL.it/myApi.asmx -o C:\dataIn\mtResponse.xml --verbose 
  29/06/2020 16:33:06   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  29/06/2020 16:33:06                                  Dload  Upload   Total   Spent    Left  Speed
  29/06/2020 16:33:06 
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying N.N.N.N...
  29/06/2020 16:33:07 * TCP_NODELAY set
  29/06/2020 16:33:07 
    0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:06 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:08 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:10 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:11 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:12 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:13 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:14 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:15 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:16 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:17 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:18 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:19 --:--:--     0
    0     0    0     0    0     0      0      0 --:--:--  0:00:20 --:--:--     0* connect to N.N.N.N port 80 failed: Timed out
  29/06/2020 16:33:27 * Failed to connect to www.myURL.it port 80: Timed out
  29/06/2020 16:33:27 
    0     0    0     0    0     0      0      0 --:--:--  0:00:21 --:--:--     0
  29/06/2020 16:33:27 * Closing connection 0
  29/06/2020 16:33:27 curl: (7) Failed to connect to www.myURL.it port 80: Timed out
  29/06/2020 16:33:27 
  </code></pre>
  <p>And my curl version is the following:</p>
  <pre><code>C:\&gt;curl --version
  curl 7.64.1 (x86_64-pc-win32) libcurl/7.64.1 OpenSSL/1.1.1b (Schannel) zlib/1.2.11 brotli/1.0.7 WinIDN libssh2/1.8.2 nghttp2/1.37.0
  Release-Date: 2019-03-27
  Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
  Features: AsynchDNS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile MultiSSL NTLM SPNEGO SSL SSPI TLS-SRP brotli libz
  </code></pre>
  <p>What am I missing to keep curl waiting for server for at least 240 seconds?</p>