Ivan Krylov
2023-May-11 06:39 UTC
[R] win110 + R 4.3.0 dowload only when method = "wininet"
On Wed, 10 May 2023 22:13:15 +0000 Sebasti?n Kruk Gencarelli <zloto_kruk at hotmail.com> wrote:> I don?t know what kind of proxy is used by my system.Do you at least know whether it's an HTTP proxy, a SOCKS proxy, or something completely different? Do you need to authenticate to the proxy?> How I can add my proxy and port to my R configuration?libcurl recognises the "http_proxy" environment variable, which can include the protocol, the address and the port of the proxy server: https://curl.se/libcurl/c/CURLOPT_PROXY.html For example, if you have a SOCKS5 hostname-resolving proxy on address 192.2.0.1 and port 1080, you can try calling Sys.setenv('http_proxy' 'socks5h://192.2.0.1:1080'). For a different example, an HTTP proxy on 198.51.100.2, port 8080 can be set up as Sys.setenv('http_proxy' 'http://198.51.100.2:8080'). (In both cases, the proxy will be used by curl for HTTP and HTTPS access, but not, say, FTP or other protocols. For HTTPS via HTTP proxy, curl will be using the CONNECT verb.) Detecting the right proxy for a given address (and yes, it's expected to do that per-address) is hard?. It's been a "nice to have" feature in curl for years: https://curl.se/docs/todo.html#auto_detect_proxy, so I'm afraid it won't happen any time soon. It's unfortunate that the curl back-end will break something that used to work with wininet. I wonder whether it could make sense to call WinHttpGetIEProxyConfigForCurrentUser() [*] when setting up connections on Windows. There's no simple way to deal with the proxy auto-configuration file [**], but we could at least call curl_easy_setopt(handle, CURLOPT_PROXY, wchar_to_current_locale(proxy_config->lpszProxy)); to make the transition from wininet to curl slightly less painful. Or would that break even more installations? This won't help in the more complicated cases [***], though. -- Best regards, Ivan [*] https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpgetieproxyconfigforcurrentuser [**] https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file Then again, library(V8) is nowadays more or less required for R package development if not R development proper. [***] https://stat.ethz.ch/pipermail/r-help/2022-September/475917.html
Sebastián Kruk Gencarelli
2023-May-11 13:49 UTC
[R] win110 + R 4.3.0 dowload only when method = "wininet"
I know exactly what is my proxy. I tried Sys.env(?) but it is forgoted in the next session. Enviado desde Correo<https://go.microsoft.com/fwlink/?LinkId=550986> para Windows De: Ivan Krylov<mailto:krylov.r00t at gmail.com> Enviado: jueves, 11 de mayo de 2023 3:39 Para: Sebasti?n Kruk Gencarelli<mailto:zloto_kruk at hotmail.com> CC: r-help at r-project.org<mailto:r-help at r-project.org> Asunto: Re: [R] win110 + R 4.3.0 dowload only when method = "wininet" On Wed, 10 May 2023 22:13:15 +0000 Sebasti?n Kruk Gencarelli <zloto_kruk at hotmail.com> wrote:> I don?t know what kind of proxy is used by my system.Do you at least know whether it's an HTTP proxy, a SOCKS proxy, or something completely different? Do you need to authenticate to the proxy?> How I can add my proxy and port to my R configuration?libcurl recognises the "http_proxy" environment variable, which can include the protocol, the address and the port of the proxy server: https://curl.se/libcurl/c/CURLOPT_PROXY.html For example, if you have a SOCKS5 hostname-resolving proxy on address 192.2.0.1 and port 1080, you can try calling Sys.setenv('http_proxy' 'socks5h://192.2.0.1:1080'). For a different example, an HTTP proxy on 198.51.100.2, port 8080 can be set up as Sys.setenv('http_proxy' 'http://198.51.100.2:8080'). (In both cases, the proxy will be used by curl for HTTP and HTTPS access, but not, say, FTP or other protocols. For HTTPS via HTTP proxy, curl will be using the CONNECT verb.) Detecting the right proxy for a given address (and yes, it's expected to do that per-address) is hard?. It's been a "nice to have" feature in curl for years: https://curl.se/docs/todo.html#auto_detect_proxy, so I'm afraid it won't happen any time soon. It's unfortunate that the curl back-end will break something that used to work with wininet. I wonder whether it could make sense to call WinHttpGetIEProxyConfigForCurrentUser() [*] when setting up connections on Windows. There's no simple way to deal with the proxy auto-configuration file [**], but we could at least call curl_easy_setopt(handle, CURLOPT_PROXY, wchar_to_current_locale(proxy_config->lpszProxy)); to make the transition from wininet to curl slightly less painful. Or would that break even more installations? This won't help in the more complicated cases [***], though. -- Best regards, Ivan [*] https://learn.microsoft.com/en-us/windows/win32/api/winhttp/nf-winhttp-winhttpgetieproxyconfigforcurrentuser [**] https://developer.mozilla.org/en-US/docs/Web/HTTP/Proxy_servers_and_tunneling/Proxy_Auto-Configuration_PAC_file Then again, library(V8) is nowadays more or less required for R package development if not R development proper. [***] https://stat.ethz.ch/pipermail/r-help/2022-September/475917.html [[alternative HTML version deleted]]
Ivan Krylov
2023-May-11 14:29 UTC
[R] win110 + R 4.3.0 dowload only when method = "wininet"
? Thu, 11 May 2023 13:49:43 +0000 Sebasti?n Kruk Gencarelli <zloto_kruk at hotmail.com> ?????:> I tried Sys.env(?) but it is forgoted in the next session.If Sys.setenv() works for you, you can put the line http_proxy=http://192.2.0.1:8080/ (or an appropriate equivalent) into an environment file that R reads when it starts up. Specifically, this environment file could be named ".Renviron" and placed into your Documents directory, but there are other options too: https://cran.r-project.org/bin/windows/base/rw-FAQ.html#What-are-HOME-and-working-directories_003f (see questions 2.13 and 2.14 for what R considers "the home directory" and how environment variables can be set). It could be worth raising a feature request for automatic proxy detection on Windows when libcurl download method is used, though I don't know whether it would be practical to implement it. -- Best regards, Ivan