[英]Ignore SSL errors in R httr connection
Updated:更新:
I am trying to access a corporate internal web API using:我正在尝试使用以下方式访问公司内部 Web API:
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.我使用ssl_verifypeer
,因为服务器的 CA 证书存在问题。 is that what is causing the issue with the SSL connect error
?这是导致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?如果您在 linux 命令行中运行,有没有办法轻弹存在的--insecure
选项? Note I am running R on windows though.注意我在 Windows 上运行 R。
只需运行这一行:
httr::set_config(config(ssl_verifypeer = 0L))
If someone is coming here looking for a solution for {httr2}
, you can do it like this:如果有人来这里寻找{httr2}
的解决方案,您可以这样做:
library(httr2)
req <- request("https://example.com") %>%
req_options(ssl_verifypeer = 0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.