-
Notifications
You must be signed in to change notification settings - Fork 155
Description
This may be a duplicate of two existing issues for other functions,
#649
#682
But I wanted to note that remotes::install_version() also does not seem to pass on headers for libcurl downloads. remotes::install_cran() does, however. The use case here would be for authenticating to a private CRAN repo.
The documentation does say ... passes args on to install.packages() which install_version() probably doesn't even use at all. So maybe also reword this to "passes arguments on to download.file() or something?
For now, you can work around this by switching to alternate download methods like curl, so not a huge priority either. With other download methods, you also have the convenience of setting headers by default and being able to use a netrc file.
Here is a repro with webfakes and pak (likely needs the development version 0.8.0.9000): https://pak.r-lib.org/dev/reference/repo-auth.html
repo <- webfakes::new_app_process(pak:::auth_proxy_app())
options(internet.info = 0)
options(repos = c(CRAN = repo$url()))
remotes::install_version("testit", "0.12", headers = c(Authorization = "Basic dXNlcm5hbWU6dG9rZW4="))
> GET /src/contrib/PACKAGES.rds HTTP/1.1
Host: 127.0.0.1:34031
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
> GET /src/contrib/PACKAGES.gz HTTP/1.1
Host: 127.0.0.1:34031
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
> GET /src/contrib/PACKAGES HTTP/1.1
Host: 127.0.0.1:34031
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
> GET //src/contrib/Meta/archive.rds HTTP/1.1
Host: 127.0.0.1:34031
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
< HTTP/1.1 401 Unauthorized
# Error in download_version_url(package, version, repos, type) :
# couldn't find package 'testit'And here's the behavior for remotes::install_cran() - it does work, but also makes a few initial PACKAGES requests without headers, so maybe that's a small issue that could be improved separately
repo <- webfakes::new_app_process(pak:::auth_proxy_app())
options(internet.info = 0)
options(repos = c(CRAN = repo$url()))
remotes::install_cran("testit", headers = c(Authorization = "Basic dXNlcm5hbWU6dG9rZW4="))
> GET /src/contrib/PACKAGES.rds HTTP/1.1
Host: 127.0.0.1:34443
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
> GET /src/contrib/PACKAGES.gz HTTP/1.1
Host: 127.0.0.1:34443
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
> GET /src/contrib/PACKAGES HTTP/1.1
Host: 127.0.0.1:34443
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Pragma: no-cache
< HTTP/1.1 401 Unauthorized
> GET /src/contrib/PACKAGES.rds HTTP/1.1
Host: 127.0.0.1:34443
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Authorization: Basic dXNlcm5hbWU6dG9rZW4=
Pragma: no-cache
...
> GET /src/contrib/testit_0.13.tar.gz HTTP/1.1
Host: 127.0.0.1:34443
User-Agent: R/4.3.3 (ubuntu-22.04) R (4.3.3 x86_64-pc-linux-gnu x86_64 linux-gnu)
Accept: */*
Authorization: Basic dXNlcm5hbWU6dG9rZW4=