[R-pkg-devel] download.file and https

Dirk Eddelbuettel edd at debian.org
Fri Jul 3 17:25:40 CEST 2015


On 3 July 2015 at 10:24, Paul Gilbert wrote:
| The difficulty with most workarounds suggested so far is the expanded 
| list of dependencies. My package and quantmod, have had a simple 
| dependency on download.file in utils. Picking on Dirks suggestion as an 
| example, it would add a system dependency on libcurl and an R package 
| dependency on curl, which in turn has system dependencies libcurl-devel 
| (rpm) or libcurl4-openssl-dev (deb). Furthermore, it suggests testthat, 

Well but you cannot have https without these.

Moreover, Depends != Suggests.  That really matters.

| knitr, jsonlite, rmarkdown, and magrittr, which means that these and 
| their dependencies, imports, and suggests all need to be installed and 
| working in order for me to test, and working with R-devel for me to 
| submit to CRAN.

Not my experience.

The .travis.yml I use for random (still) installs curl from source, yet is
done in under a minute.  I never remember whether others can browse my test
history but try

   https://travis-ci.org/eddelbuettel/random/builds   

As Michael Rutter has curl in his cran2deb4ubuntu PPA knows by the R-Travis
setup, I might as well install his r-cran-curl which would make this yet a
little faster.
 
| Let me mention again that this problem is not specific to my package or 
| quantmod. It will be quickly affecting everyone that downloads from US 
| government websites, not to mention that other governments and 
| commercial web sites may start doing the same thing.

Use of curl (to provide https) will become much more common. R now supports
it in R 3.2.0, but only as optional build-time choice.  With that I find
Jeroen's package a pretty good choice.

But that is of course just one suggestion, and if it doesn't work for you I
fully understand.  I was faced with the exact same problem -- Mads switched
random.org to https-only -- and would like to see what other suggestions
people may have.

Dirk
 
| Paul
| 
| On 07/03/2015 06:39 AM, Dirk Eddelbuettel wrote:
| >
| > In random, I do the following, using R 3.2.0 or later with libcurl where
| > installed, and Jeroen's lightweight curl::curl otherwise.
| >
| >
| > getConnection <- function(urltxt, ...) {
| >      if (getRversion() >= "3.2.0" && capabilities()["libcurl"]) {
| >          url(urltxt, ..., method="libcurl")
| >      } else {
| >          curl(urltxt, ...)
| >      }
| > }
| >
| > closeConnection <- function(con) {
| >      if (getRversion() >= "3.2.0" && capabilities()["libcurl"]) {
| >          close(con)
| >      } else {
| >          ## nothing to be done for curl()
| >      }
| > }
| >
| >
| > Hth,  Dirk
| >

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org



More information about the R-package-devel mailing list