-
Notifications
You must be signed in to change notification settings - Fork 70
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
Proxy settings in Windows #1
Comments
Oh that would be awesome! |
I've implemented a function |
What's the argument for not doing this by default? |
It's windows, it has it's own logic/configuration that might not map perfectly to libcurl. But maybe if we test it and it works well can do it by default. |
So the API returns these 4 fields:
Libcurl also allows for setting |
Judging from a cursory reading of the SO post linked by @jeroenooms, auto-detected proxies require a further call to IMO, it'd be reasonable to do the following:
|
I don't have enough faith in this to enable it by default. For example I noticed if the configured proxy is set to an invalid or dead server, windows will silently ignore it. I suppose this is considered a feature. However if we set an invalid proxy in libcurl, it won't connect or might even crash. Perhaps we can have something like |
The 'auto proxy' just points to a piece of JavaScript that maps a URL to a proxy server: https://en.wikipedia.org/wiki/Proxy_auto-config |
This is now mostly implemented, see the announcement post. However I do not have access to a proxy server to actually test this. |
I don't know if this is relevant but in the latest R release (3.2.2):
|
Not working on my PAC.
|
Can you show us the source code of your pac file? |
A shortened and half-cleaned one here. Too long to clean all the IPs so I've omitted quite a few, I hope it doesn't affect the trouble shooting. |
Mmm strange. In the topic you said initially that for |
Apologies, apparently the error is my side (malformed value in |
I think this is all working now. At least haven't heard complaints for a while. |
Hi, I'm rying to get bypass the pac proxy setup at my work to be able to download packages in R. The following gave me an error. Please advise! Greatly appreciate it. Have attach a snapshot of my internet settings. require("curl") curl_with_proxy <- function(url, verbose = TRUE){ con <- curl_with_proxy("https://httpbin.org/get") Sys.setenv(http_proxy_user = "plum:apple") The error that was printed in the console:
|
with Is their a specificity in |
Curl uses separate varaibles for http and https proxy. Here is an example https://gist.github.com/jeroen/5127c288f8914bdb20be |
ok Thanks for the gist. I understand it is case sensitive. It is working for me. @sagar-m you should try. If you want me to try document this somewhere, let me know. |
Hi @cderv , not sure I followed. Please explain how I can resolve the error. Thank you so much. |
As shown in the gist, configure environnement variables in R. It will be understand by libcurl. You just need to know you proxy url. Sys.setenv(http_proxy = "[scheme://][user:password@]machine[:port]")
Sys.setenv(HTTPS_PROXY= "[scheme://][user:password@]machine[:port]") Replace bracket parts with your specific case. for me, Try configure your proxy and run these lines to test # http test
readLines(base::url("http://httpbin.org/get", method = "libcurl"))
readLines(curl::curl("http://httpbin.org/get"))
# https test
readLines(base::url("https://httpbin.org/get", method = "libcurl"))
readLines(curl::curl("https://httpbin.org/get")) |
Hi Jeroen,
Thank yoy for your suggestion; however I am still not able to get past
the proxy. Any comments would be much appreciated. Thank you very
much.
Your suggestion was:
Sys.setenv(http_proxy = "[scheme://][user:password@]machine[:port]")
Sys.setenv(HTTPS_PROXY= "[scheme://][user:password@]machine[:port]")
I altered it to:
Sys.setenv(http_proxy = "http://user:password@FGProxy1:3128")
Sys.setenv(HTTPS_PROXY = "http://user:password@FGProxy1:3128")
However, I am still not able to download packages.
The following command results in:
readLines(base::url("http://httpbin.org/get", method = "libcurl"))
readLines(curl::curl("http://httpbin.org/get"))
results in:
readLines(base::url("http://httpbin.org/get", method = "libcurl"))
[1] "{"
[2] " \"args\": {}, "
[3] " \"headers\": {"
[4] " \"Accept\": \"*/*\", "
[5] " \"Connection\": \"close\", "
[6] " \"Host\": \"httpbin.org\", "
[7] " \"User-Agent\": \"R (3.3.3 x86_64-w64-mingw32 x86_64 mingw32)\", "
[8] " \"X-Imforwards\": \"20\""
[9] " }, "
[10] " \"origin\": \"203.215.51.245\", "
[11] " \"url\": \"http://httpbin.org/get\""
[12] "}"
readLines(curl::curl("http://httpbin.org/get"))
[1] "{"
[2] " \"args\": {}, "
[3] " \"headers\": {"
[4] " \"Accept\": \"*/*\", "
[5] " \"Accept-Encoding\": \"gzip, deflate\", "
[6] " \"Connection\": \"close\", "
[7] " \"Host\": \"httpbin.org\", "
[8] " \"User-Agent\": \"r/curl/jeroen\", "
[9] " \"X-Imforwards\": \"20\""
[10] " }, "
[11] " \"origin\": \"203.215.51.245\", "
[12] " \"url\": \"http://httpbin.org/get\""
[13] "}"
…On Mon, May 22, 2017 at 5:34 PM, Christophe Dervieux < ***@***.***> wrote:
As shown in the gist, configure environnement variables in R. It will be
understand by libcurl. You just need to know you proxy url.
curl::ie_get_proxy_for_url() could help.
Sys.setenv(http_proxy = "[scheme://][user:password@]machine[:port]")
Sys.setenv(HTTPS_PROXY= "[scheme://][user:password@]machine[:port]")
Replace bracket parts with your specific case. for me, [scheme://] is
http://
Try configure your proxy and run these lines to test
# http test
readLines(base::url("http://httpbin.org/get", method = "libcurl"))
readLines(curl::curl("http://httpbin.org/get"))
# https test
readLines(base::url("https://httpbin.org/get", method = "libcurl"))
readLines(curl::curl("https://httpbin.org/get"))
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AahSIeNbMLs8HrknwkUf0E22rE6XEmnmks5r8Xm4gaJpZM4C_ev->
.
|
@sagar-m from your output it looks like things are working. What error do you get? |
Hi Jeroen,
When I code "install.packages("uroot"),
this is what I get:
install.packages("uroot")
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES.gz': HTTP
status was '407 Proxy Authentication Required'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES': HTTP
status was '407 Proxy Authentication Required'
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'
Warning in install.packages :
cannot open URL '
http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.gz': HTTP status
was '407 Proxy Authentication Required'
Warning in install.packages :
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES':
HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
unable to access index for repository
http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Installing package into ‘C:/Users/362969/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES.gz': HTTP
status was '407 Proxy Authentication Required'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/src/contrib/PACKAGES': HTTP
status was '407 Proxy Authentication Required'
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'
Warning in install.packages :
cannot open URL '
http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES.gz': HTTP status
was '407 Proxy Authentication Required'
Warning in install.packages :
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES':
HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
unable to access index for repository
http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Warning in install.packages :
package ‘uroot’ is not available (for R version 3.3.3)
Warning in install.packages :
closing unused connection 4 (http://httpbin.org/get)
Warning in install.packages :
closing unused connection 3 (http://httpbin.org/get)
Warning in install.packages :
cannot open URL '
https://cran.rstudio.com/bin/windows/contrib/3.3/PACKAGES.gz': HTTP status
was '407 Proxy Authentication Required'
Warning in install.packages :
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/PACKAGES':
HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
unable to access index for repository
https://cran.rstudio.com/bin/windows/contrib/3.3:
cannot open URL 'https://cran.rstudio.com/bin/windows/contrib/3.3/PACKAGES
'
Warning in install.packages :
cannot open URL '
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.3/PACKAGES.gz':
HTTP status was '407 Proxy Authentication Required'
Warning in install.packages :
cannot open URL '
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.3/PACKAGES': HTTP
status was '407 Proxy Authentication Required'
Warning in install.packages :
unable to access index for repository
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.3:
cannot open URL '
http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.3/PACKAGES'
…On Mon, Jun 12, 2017 at 3:24 PM, Jeroen Ooms ***@***.***> wrote:
@sagar-m <https://github.com/sagar-m> from your output it looks like
things are working. What error do you get?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AahSIWaPZO17R92oiLB5lFRpw5DnNU6Cks5sDQrVgaJpZM4C_ev->
.
|
You are using an old version of R. You can solve the problem by upgrading to R 3.4. If you don't want to upgrade, try this: install.packages("uroot", method = "libcurl") |
Thank you so much. It is working now.
install.packages("txtplot", method = "libcurl") helped.
…On Mon, Jun 12, 2017 at 4:04 PM, Jeroen Ooms ***@***.***> wrote:
You are using an old version of R. You can solve the problem by upgrading
to R 3.4. If you don't want to upgrade, try this:
install.packages("uroot", method = "libcurl")
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AahSIUSsMbgcan8RfcuMcpVN2f-fz8prks5sDRRRgaJpZM4C_ev->
.
|
Read proxy settings in windows to mimic
setInternet2
:http://stackoverflow.com/questions/202547/how-do-i-find-out-the-browsers-proxy-settings
The text was updated successfully, but these errors were encountered: