diff --git a/NAMESPACE b/NAMESPACE index 8ca7e504..c2e13097 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -47,6 +47,7 @@ export(accept_json) export(accept_xml) export(add_headers) export(authenticate) +export(brew_dr) export(build_url) export(cache_info) export(config) diff --git a/NEWS.md b/NEWS.md index 08016981..81a74286 100644 --- a/NEWS.md +++ b/NEWS.md @@ -31,9 +31,9 @@ * Fix for OAuth 2 process when using `options(httr_oob_default = TRUE)` (#126, @WillemPaling). -* httr checks to see if your libCurl uses NSS. This is unlikely to work - so it gives you some advice on how to fix the problem (thanks to - @eddelbuettel for debugging this problem). +* New `brew_dr()` checks for common problems. Currently checks if your libCurl + uses NSS. This is unlikely to work so it gives you some advice on how to + fix the problem (thanks to @eddelbuettel for debugging this problem). * `Content-Type` set to title case to avoid errors in servers which do not correctly implement case insensitivity in header names. (#142, #146) thanks diff --git a/R/doctor.R b/R/doctor.R new file mode 100644 index 00000000..fe59c580 --- /dev/null +++ b/R/doctor.R @@ -0,0 +1,30 @@ +#' Diagnose common configuration problems +#' +#' Currently one check: that curl uses nss. +#' +#' @export +brew_dr <- function() { + check_for_nss() +} + +check_for_nss <- function() { + if (!grepl("^NSS", RCurl::curlVersion()$ssl_version)) return() + + warning(' + ------------------------------------------------------------------------ + Your installed RCurl is linked to the NSS library (`libcurl4-nss-dev`) + which is likely to cause issues. + + To resolve the problem: + + 1. Quit R. + + 2. Install OpenSSL (`apt-get install libcurl4-openssl-dev`) or + GnuTLS (`apt-get install libcurl4-gnutls-dev`) variants of libCurl. + + 3. Restart R. + + 4. Reinstall RCurl: `install.packages("RCurl")`. + ------------------------------------------------------------------------ + ', call. = FALSE) +} diff --git a/R/zzz.R b/R/zzz.R index 2bfc9675..d36a641b 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,6 +1,4 @@ .onLoad <- function(libname, pkgname) { - check_for_nss() - op <- options() op.dplyr <- list( httr_oob_default = FALSE, @@ -18,25 +16,3 @@ release_questions <- function() { "Is inst/cacert.pem up to date?" ) } - -check_for_nss <- function() { - if (!grepl("^NSS", RCurl::curlVersion()$ssl_version)) return() - - warning(' - ------------------------------------------------------------------------ - Your installed RCurl is linked to the NSS library (`libcurl4-nss-dev`) - which is likely to cause issues. - - To resolve the problem: - - 1. Quit R. - - 2. Install OpenSSL (`apt-get install libcurl4-openssl-dev`) or - GnuTLS (`apt-get install libcurl4-gnutls-dev`) variants of libCurl. - - 3. Restart R. - - 4. Reinstall RCurl: `install.packages("RCurl")`. - ------------------------------------------------------------------------ - ', call. = FALSE) -} diff --git a/cran-comments.md b/cran-comments.md index 03b8f545..c83ddaaf 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,3 +1,7 @@ +Minor update: this version moves automated NSS check into explicit function to avoid false-positives. + +--- + ## Test environments * local OS X install, R 3.1.2 * ubuntu 12.04 (on travis-ci), R 3.1.2