Ignore SSL errors in R httr connection

KillerSnail picture KillerSnail · May 3, 2016 · Viewed 7.2k times · Source

Updated:

I am trying to access a corporate internal web API using:

require(httr)
url = 'https://my_server/api/search/query?q=stuff'
httr::set_config( config(ssl_verifypeer = 0L) )
data <- httr::GET( url, use_proxy(url = "ipaddress:port"), verbose() )

I get:

-> CONNECT my_server:port HTTP/1.1
-> Host: my_server:port
-> User-Agent: libcurl/7.47.1 r-curl/0.9.7 httr/1.1.0
-> Proxy-Connection: Keep-Alive
-> 
<- HTTP/1.1 200 Connection established
<- 
Error in curl::curl_fetch_memory(url, handle = handle) : 
  SSL connect error    

I used ssl_verifypeer as there are issues with the CA cert of the server. is that what is causing the issue with the SSL connect error ?

How do I bypass this and get the data? is there a way to flick the --insecure option that exists if you run in the linux command line? Note I am running R on windows though.

Answer

user6472132 picture user6472132 · Jun 16, 2016

Simply run this line:

httr::set_config(config(ssl_verifypeer = 0L))