Skip to content

Commit

Permalink
Move nss check into brew_dr()
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Dec 13, 2014
1 parent 43b75e1 commit 5e44a82
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 27 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions R/doctor.R
Original file line number Diff line number Diff line change
@@ -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)
}
24 changes: 0 additions & 24 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.onLoad <- function(libname, pkgname) {
check_for_nss()

op <- options()
op.dplyr <- list(
httr_oob_default = FALSE,
Expand All @@ -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)
}
4 changes: 4 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 5e44a82

Please sign in to comment.