I am trying to obtain a zip from a https:// website:
url <- 'https://www150.statcan.gc.ca/n1/tbl/csv/23100008-eng.zip'
file_path <- './data/mydata.zip'
download.file(url, file_path)
I also have tried changing the method to 'curl', 'libcurl and 'get'
I get:
trying URL 'https://www150.statcan.gc.ca/n1/tbl/csv/23100008-eng.zip'
Error in download.file(url, file_path) :
cannot open URL 'https://www150.statcan.gc.ca/n1/tbl/csv/23100008-eng.zip'
In addition: Warning message:
In download.file(url, file_path) :
URL 'https://www150.statcan.gc.ca/n1/tbl/csv/23100008-eng.zip': status was 'SSL connect error'
My sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale:
[1] LC_CTYPE=en_CA.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8
[4] LC_COLLATE=en_CA.UTF-8 LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_CA.UTF-8
[7] LC_PAPER=en_CA.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.4.6 lubridate_1.7.9 crayon_1.3.4 dplyr_1.0.0
[5] R6_2.4.1 lifecycle_0.2.0 magrittr_1.5 pillar_1.4.4
[9] httr_1.4.1 stringi_1.4.6 rlang_0.4.6 rstudioapi_0.11
[13] snakecase_0.11.0 vctrs_0.3.1 generics_0.0.2 ellipsis_0.3.1
[17] tools_4.0.2 stringr_1.4.0 glue_1.4.1 purrr_0.3.4
[21] janitor_2.0.1 compiler_4.0.2 pkgconfig_2.0.3 tidyselect_1.1.0
[25] tibble_3.0.1
Oddly enough, the code runs perfectly in a Win OS but not in Ubuntu 20.04 LTS OS. I am not sure, but the issue seems to be a CA one which I have not been able to solve.
From my terminal:
openssl version -a
OpenSSL 1.1.1f 31 Mar 2020
built on: Mon Apr 20 11:53:50 2020 UTC
platform: debian-amd64
options: bn(64,64) rc4(16x,int) des(int) blowfish(ptr)
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-P_ODHM/openssl-1.1.1f=. -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_TLS_SECURITY_LEVEL=2 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
OPENSSLDIR: "/usr/lib/ssl"
ENGINESDIR: "/usr/lib/x86_64-linux-gnu/engines-1.1"
Seeding source: os-specific
I tried using httr:
library(httr)
set_config(config(ssl_verifypeer = FALSE))
httr::GET("https://www150.statcan.gc.ca/n1/tbl/csv/23100008-eng.zip")
Error in curl::curl_fetch_memory(url, handle = handle) :
error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type
I also tried modifying the openssl.cnf, but I am still getting the same 'SSL connect error'