title: RCurl getURL with FTP over proxy
body: <p>In R I'm trying to get data from a ftp server using RCurl. The server has explicit encryption activated. Below one of the many attempts to make this work but I always get <strong>530 Login or password incorrect!</strong> Still the username / password works when using another client like WinSCP. Any help is welcome!</p>
  <pre><code>library(RCurl)
  
  # CURL_SSLVERSION_TLSv1_1 &lt;- 5L
  # CURL_SSLVERSION_TLSv1_2 &lt;- 6L
  
  opts &lt;- curlOptions(
    proxy         = &quot;http://my.proxy/&quot;,
    proxyport     = 8080,
    dirlistonly = TRUE,
    sslversion = 6L,
    ftp.use.epsv = FALSE,
    ssl.verifypeer=TRUE
    
  )
  
   dat &lt;- getURL(&quot;ftp://myUser:myPaas@ftps.myServer.com/&quot;, .opts = opts )
  </code></pre>
  <p>Here some screenshots of the winscp setup (only German OS available)</p>
  <p>Connection screen:</p>
  <p><a href="https://i.stack.imgur.com/K2woI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K2woI.png" alt="enter image description here" /></a></p>
  <p>Protocol screen:</p>
  <p><a href="https://i.stack.imgur.com/U0Ulw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/U0Ulw.png" alt="enter image description here" /></a></p>
  <p>WinSCP connection string:</p>
  <p><a href="https://i.stack.imgur.com/CMtVo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CMtVo.png" alt="enter image description here" /></a></p>
  <pre class="lang-none prettyprint-override"><code>Here is the output having verbose = TRUE added
  
  *   Trying 10.x.x.x...
  * Connected to 10.x.x.x (10.x.x.x) port 8080 (#0)
  &gt; GET ftp://User:Pass@ftp.myserver.com/ HTTP/1.1
   Host: ftp.myserver.com:21
   Accept: */*
   Proxy-Connection: Keep-Alive
  
  &lt; HTTP/1.1 403 Forbidden
  &lt; Server: squid/3.5.20
  &lt; Mime-Version: 1.0
  &lt; Date: Thu, 15 Nov 2018 11:12:24 GMT
  &lt; Content-Type: text/html;charset=utf-8
  &lt; Content-Length: 3898
  &lt; X-Squid-Error: ERR_FTP_FORBIDDEN 530
  &lt; Vary: Accept-Language
  &lt; Content-Language: en
  &lt; WWW-Authenticate: Basic realm=&quot;FTP ftp.myserver.com&quot;
  &lt; X-Cache: MISS from Proxy-xxxxxx
  &lt; X-Cache-Lookup: MISS from Proxy-xxxxx:8080
  &lt; Via: 1.1 Proxy-xxxxxx (squid/3.5.20)
  &lt; Connection: keep-alive
  &lt; 
   * Connection #0 to host 10.x.x.x left intact
  </code></pre>
  <p>Here is the WinSCP log:</p>
  <pre class="lang-none prettyprint-override"><code>. 2018-11-15 17:09:15.999 Verbinde mit ftp.MyServer.com ...
  . 2018-11-15 17:09:15.999 HTTP proxy command: CONNECT ftp.MyServer.com:21 HTTP/1.1
  
  . 2018-11-15 17:09:15.999 Host: ftp.MyServer.com:21
  
  . 2018-11-15 17:09:16.014 Verbindung mit dem Proxy hergestellt, führe Handshakes aus ...
  . 2018-11-15 17:09:16.039 HTTP proxy response: HTTP/1.1 200 Connection established
  . 2018-11-15 17:09:16.039 HTTP proxy headers: 
  
  . 2018-11-15 17:09:16.039 
  
  . 2018-11-15 17:09:16.039 Verbunden mit ftp.MyServer.com, TLS Verbindung wird ausgehandelt...
  &lt; 2018-11-15 17:09:16.059 220 Welcome to FTP MyServer
  &gt; 2018-11-15 17:09:16.059 AUTH TLS
  &lt; 2018-11-15 17:09:16.093 234 Using authentication type TLS
  . 2018-11-15 17:09:16.179 Verifying certificate for &quot;MY Server&quot; with fingerprint xx:yy:zz.............. and 18 failures
  . 2018-11-15 17:09:16.179 Certificate common name &quot;ftp.MyServer.com&quot; matches hostname
  . 2018-11-15 17:09:16.179 Certificate for &quot;MY Server&quot; matches cached fingerprint and failures
  . 2018-11-15 17:09:16.179 Using TLSv1.2, cipher TLSv1/SSLv3: ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA, ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
  . 2018-11-15 17:09:16.216 TLS Verbindung hergestellt. Warte auf die Willkommensnachricht...
  &gt; 2018-11-15 17:09:16.216 USER MyUser
  &lt; 2018-11-15 17:09:16.216 331 Password required for MyUser
  &gt; 2018-11-15 17:09:16.216 PASS **********
  &lt; 2018-11-15 17:09:16.236 230 Logged on
  </code></pre>
  <p>Here is the R console log with more info:</p>
  <pre class="lang-none prettyprint-override"><code> *   Trying 10.101.0.32...
   * Connected to 10.101.0.32 (10.x.x.x) port 8080 (#0)
   &gt; GET ftp://MyUser:@ftp.MyServer.com/ HTTP/1.1
   Host: ftp.MyServer.com:21
   Accept: */*
   Proxy-Connection: Keep-Alive
   
   &lt; HTTP/1.1 401 Unauthorized
   &lt; Server: squid/3.5.20
   &lt; Mime-Version: 1.0
   &lt; Date: Fri, 16 Nov 2018 08:25:46 GMT
   &lt; Content-Type: text/html;charset=utf-8
   &lt; Content-Length: 3898
   &lt; X-Squid-Error: ERR_FTP_FORBIDDEN 530
   &lt; Vary: Accept-Language
   &lt; Content-Language: en
   &lt; WWW-Authenticate: Basic realm=&quot;FTP MyServer ftp.MyServer.com&quot;
   &lt; X-Cache: MISS from Proxy-xxxx
   &lt; X-Cache-Lookup: MISS from Proxy-xxxx:8080
   &lt; Via: 1.1 Proxy-xxxx (squid/3.5.20)
   &lt; Connection: keep-alive
   &lt; 
   * Ignoring the response-body
   * Connection #0 to host 10.x.x.x left intact
   * Issue another request to this URL: 'ftp://ftp.MyServer.com'
   * Found bundle for host ftp.MyServer.com: 0xafea17a
   * Re-using existing connection! (#0) with host 10.x.x.x
   * Connected to 10.x.x.x (10.x.x.x) port 8080 (#0)
   * Server auth using Basic with user 'Nordex'
   &gt; GET ftp://MyUser:@ftp.MyServer.com/ HTTP/1.1
   Authorization: Basic Tm9yZGV50g==
   Host: ftp.MyServer.com:21
   Accept: */*
   Proxy-Connection: Keep-Alive
   
   &lt; HTTP/1.1 401 Unauthorized
   &lt; Server: squid/3.5.20
   &lt; Mime-Version: 1.0
   &lt; Date: Fri, 16 Nov 2018 08:25:46 GMT
   &lt; Content-Type: text/html;charset=utf-8
   &lt; Content-Length: 3947
   &lt; X-Squid-Error: ERR_FTP_FORBIDDEN 530
   &lt; Vary: Accept-Language
   &lt; Content-Language: en
   * Authentication problem. Ignoring this.
   &lt; WWW-Authenticate: Basic realm=&quot;FTP MyServer ftp.MyServer.com&quot;
   &lt; X-Cache: MISS from Proxy-xxxx
   &lt; X-Cache-Lookup: MISS from Proxy-xxxx:8080
   &lt; Via: 1.1 Proxy-xxxx (squid/3.5.20)
   &lt; Connection: keep-alive
   &lt; 
   * Connection #0 to host 10.x.x.x left intact
  </code></pre>