Ignore SSL errors in R httr connection

风格不统一 提交于 2019-12-12 11:07:53

问题


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.


回答1:


Simply run this line:

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


来源:https://stackoverflow.com/questions/36997896/ignore-ssl-errors-in-r-httr-connection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!