title: TLS v1.1 / TLS v1.2 support in RCurl
body: <blockquote>
    <p>ETA: Per <a href="https://github.com/hiratake55/RForcecom/issues/42" rel="nofollow">https://github.com/hiratake55/RForcecom/issues/42</a>, it looks like the author of the rforcecom package has updated rforcecom to use httr instead of RCurl (as of today, to be uploaded to CRAN tomorrow, 7/1/16), so my particular issue will be solved at that point. However, the general case (implementing TLS 1.1 / 1.2 in RCurl) may still be worth pursuing for other packages. Or everyone may just switch to the more recent curl package instead of RCurl.</p>
  </blockquote>
  
  <p>Background: I've been using the rforcecom package to communicate with Salesforce for several months. Salesforce recently disabled support for TLS v1.0 and is requiring TLS v1.1 or higher in their Sandboxes; this update will take place for Production environments in March 2017.</p>
  
  <p>rforcecom uses RCurl to communicate with salesforce.com servers. Generally the curlPerform method is used, which is implemented something like this (this example is from rforcecom.login.R):</p>
  
  <pre><code>h &lt;- basicHeaderGatherer()
  t &lt;- basicTextGatherer()
  URL &lt;- paste(loginURL, rforcecom.api.getSoapEndpoint(apiVersion), sep="")
  httpHeader &lt;- c("SOAPAction"="login","Content-Type"="text/xml")
  curlPerform(url=URL, httpheader=httpHeader, postfields=soapBody, headerfunction = h$update, writefunction = t$update, ssl.verifypeer=F)
  </code></pre>
  
  <p>This has been working for me for a while, as I mentioned. Now that Salesforce has disabled TLS v1.0 on Sandboxes, though, it fails with the following error:</p>
  
  <pre><code>UNSUPPORTED_CLIENT: TLS 1.0 has been disabled in this organization. Please use TLS 1.1 or higher when connecting to Salesforce using https.
  </code></pre>
  
  <p>I've modified and sourced (without implementing it in the local copy of the package, as I'm not experienced enough to do this) a change to my local copy of the login module for RForcecom, and I've discovered through experimentation that I can specify any of the existing enumerated values for SSLVERSION successfully by adding <code>sslversion=SSLVERSION_TLSv1</code>, <code>sslversion=SSLVERSION_SSLv3</code>, etc. to the curlPerform options where it is called. However, all of these give me the same error as above. When I attempt to use one of the options that is implemented in libcurl but not in RCurl (<code>SSLVERSION_TLSv1.1</code>, <code>SSLVERSION_TLSv1.2</code>), I get the following error:</p>
  
  <pre><code>Error in merge(list(...), .opts) : object 'SSLVERSION_TLSv1.1' not found
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>Error in merge(list(...), .opts) : object 'SSLVERSION_TLSv1.2' not found
  </code></pre>
  
  <p>I've verified with <code>curlVersion()</code> that my libcurl version is 7.40.0, which according to <a href="https://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html" rel="nofollow">https://curl.haxx.se/libcurl/c/CURLOPT_SSLVERSION.html</a> does support those options. However, I'm unable to get RCurl to recognize them.</p>
  
  <p>At this point what I'm looking for is a way to get RCurl to use TLS v1.1 or TLS v1.2, and I would very much appreciate any assistance I can get with that. I apologize for any problems/issues with my question as this is my first time asking one myself, I've previously always been able to muddle through by reading other people's questions and answers.</p>