有没有办法在download.file
中默认禁用SSL验证?
情况是,我们公司有一个内部CRAN镜像,但它使用的是自签名SSL证书。据我所知,这会导致download.file
失败,而且由于install.packages
使用download.file
,这意味着安装包也会失败。我想关闭验证检查,看看这是否解决了问题。
操作系统是Ubuntu 20.04 (实际上在容器中运行),R是4.1.1。
发布于 2021-10-25 22:39:22
通过将下载方法设置为curl
并指定适当的标志,可以让download.file
忽略SSL问题:
# -k means don't verify cert, -L means follow redirects (important for some servers)
options(download.file.method="curl", download.file.extra="-k -L")
download.file("https://internal.server/file", "destfile")
但是,这需要安装curl命令行工具。对于我使用的Docker镜像,情况并非如此,但这是另一个问题。
https://stackoverflow.com/questions/69716835
复制