install.packages only works with wininet, how set default download.file.method to wininet?

Hi,

I'm a package engineer currently trying to package Rstudio 2023.06.1 build 524 with R 4.3.1
With these versions install.packages doesn't work anymore and results in:
Warning in install.packages :
unable to access index for repository https://cran.rstudio.com/src/contrib:
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES'

In previous versions Rstudio 1.4.1106 with R 4.2.2 it works fine.
Tried disabling 'Use secure download method' in 2023.06.1 build 524 with R 4.3.1 but it didn't help.
This setting is enabled with 1.4.1106 and R 4.2.2 where installing packages still works.

Then I noticed that when changing the download.file.method to wininet install.packages works again.
I then found that since R 4.2+ wininet is deprecated and libcurl is now the default.
Does this mean wininet will stop working entirely at some point?

Nothing changed in our network environment but I guess something is blocked with libcurl?
I don't want to go down the road having to change firewalls/proxies so I rather set the default download.file.method to wininet.
To prevent users having to set it each time they start Rstudio how can I set the default for download.file.method to wininet at the start of Rstudio?

Yes, wininet is probably going away at some point.

The problem with libcurl is probably that it will not detect your proxy, and you'll need to set it manually. Set the http_proxy and https_proxy environment variables.

To set options at the start of RStudio, put the options() call into your .Rprofile. You can use usethis::edit_r_profile() if you don't know where your .Rprofile file is.

Thats unfortunate. For what reason? Is wininet less secure?

I tried libcurl with setting http_proxy and https_proxy (added it in .Renviron) and with options(internet.info = 0) for more debugging.
install.packages results in a connect to ip port 443 failed: Connection refused
Trying without secure download method results in a 407 Proxy authentication required

Also tried to add http_proxy_user=user_name:password or http_proxy_user=aks but then still the 407 error. (I presume user_name:password is literally, not actually my real username/password? If libcurl requires plaintext passwords that would be really unsecure)

Strange that the proxy has no problem with wininet even with https

I am not sure why wininet is going away, possibly only people in R-core know the reason.

Unfortunately libcurl is not able to auto-detect the Windows proxy configuration, so AFAIK your only choices are sticking to wininet (while it is available) and setting your password in https_proxy. I would think that the password is not sent in cleartext to the proxy if you use https.

Our company is very strict with passwords in plain text files so that's going to be a challenge then when wininet ever stops working.
Thanks for the support so far.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.