Closed kadyb closed 2 weeks ago
Can I somehow change the default curl::curl_download()
settings to have the same behavior as in utils::download.file()
on Windows?
Here are the package versions:
> packageVersion("curl")
[1] ‘4.3’
> curl::curl_version()
$version
[1] "7.64.1"
$ssl_version
[1] "(OpenSSL/1.1.1a) Schannel"
$libz_version
[1] "1.2.11"
$libssh_version
[1] "libssh2/1.8.2"
$libidn_version
[1] NA
$host
[1] "x86_64-w64-mingw32"
$protocols
[1] "dict" "file" "ftp" "ftps" "gopher" "http" "https" "imap"
[9] "imaps" "ldap" "ldaps" "pop3" "pop3s" "rtsp" "scp" "sftp"
[17] "smtp" "smtps" "telnet" "tftp"
$ipv6
[1] TRUE
$http2
[1] FALSE
$idn
[1] TRUE
It is impossible to know if a connection is "broken" or if we just need to wait for the server. You can use the CURLOPT_LOW_SPEED_TIME and CURLOPT_LOW_SPEED_LIMIT options to kill slow or stalled downloads.
When the connection is broken (or broken and restored after ~1-2 minutes), the
curl::curl_download()
function doesn't terminate.I noted this on Windows 8.1. In my case, I tried to download a ~10 MB file, the connection was broken and nothing happened for another 35 minutes (even though the Internet was restored).
In the case of the
utils::download.file()
function, after the connection is broken, the function terminates after some time and returns an error.