Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal GitHub downloader doesn't configure proxy #624

Open
mmarchetti opened this issue Feb 19, 2021 · 2 comments
Open

Internal GitHub downloader doesn't configure proxy #624

mmarchetti opened this issue Feb 19, 2021 · 2 comments

Comments

@mmarchetti
Copy link

We saw this issue in a Connect customer environment.

They have a proxy for internet access. http_proxy and https_proxy environment variables are set when packrat is invoked. Packrat has no trouble installing packages from CRAN.

What we saw is:

  • Connect configures download.file.method to be curl, and sets some curl options.
  • Packrat, with devtools and httr installed, uses its internal GitHub downloader which uses httr.
  • The internal downloader doesn't configure httr's proxy settings based on http_proxy and https_proxy.
  • Consequently, package downloads from GitHub failed.

Some ideas for fixes include always using the configured downloader, or configuring httr's proxy settings based on the standard proxy environment variables.

@mmarchetti
Copy link
Author

We worked around this by removing devtools from the R installations being used in Connect.

@kevinushey
Copy link
Contributor

See also:

packrat/R/github.R

Lines 9 to 25 in 6dd9d59

githubDownload <- function(url, destfile, ...) {
onError(1, {
github_pat <- yoink("devtools", "github_pat")
authenticate <- yoink("httr", "authenticate")
GET <- yoink("httr", "GET")
content <- yoink("httr", "content")
token <- github_pat(quiet = TRUE)
auth <- if (!is.null(token))
authenticate(token, "x-oauth-basic", "basic")
else
list()
request <- GET(url, auth)
writeBin(content(request, "raw"), destfile)
if (file.exists(destfile)) 0 else 1
})
}

packrat/R/gitlab.R

Lines 9 to 11 in 6dd9d59

gitlabDownload <- function(url, destfile, ...) {
onError(1, gitlabDownloadImpl(url, destfile, ...))
}

We could provide some mechanism for overriding the default Packrat behaviors here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants