mudasobwa mudasobwa - 1 month ago 10
R Question

download.file works only over https

I have a weird problem. I use

quantmod
package to get rates from "oanda" provider. It internally uses the
download.file
function, that fails with a message


cannot open URL 'http://www.oanda.com/.....'


I was able to narrow the problem to:

> download.file("https://oanda.com", destfile="/tmp/gh")
trying URL 'https://oanda.com'
downloaded 95 KB

> download.file("http://oanda.com", destfile="/tmp/gh")
trying URL 'http://oanda.com'
Error in download.file("http://oanda.com", destfile = "/tmp/gh") :
cannot open URL 'http://oanda.com'


Note the difference in
http
/
https
above
.

This is reproducible for any other domain. I am completely lost since I can’t google any trace of this to happen to anybody else.
wget
from the command line works perfectly for both addresses.

Probably unrelated environment details: I have
RCurl
installed. It’s being run from under local
shiny
server installed on AWS. Ubuntu 14LTS.

So, how can I make
quantmod
to use
https
for it’s call or how can I make
download.file
to work with
http
?

Answer

I'm posting my comment above as answer.

Please refer to this bug report : http://github.com/joshuaulrich/quantmod/issues/83

It seems there is an issue with curl.

If wget is working fine, you can follow the same advice and try the R command options(download.file.method="wget") to make quantmod download using wget instead of curl.

Comments