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

$no_proxy support? #277

Open
chino opened this Issue Nov 10, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@chino

chino commented Nov 10, 2017

Normally proxy settings are automatically picked up via $http(s)_proxy env vars and also importantly $no_proxy which determines when NOT to use the proxy. Ruby's core http libs already support all of this automatically.

I see some scattered notes regarding env vars in the rest-client lib:

https://github.com/rest-client/rest-client#proxy
https://github.com/rest-client/rest-client/blob/master/spec/unit/request_spec.rb#L580

This is actually affecting me while trying to use the k8s plugin in gitlab:

https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/models/project_services/kubernetes_service.rb#L169

It seems proper $no_proxy support and/or env var support would be right way to go?

@cben

This comment has been minimized.

Show comment
Hide comment
@cben

cben Mar 4, 2018

Collaborator

Thanks. Can you help us map out the current situation? A PR with just tests for current kubeclient behavior would be wonderful (but manual "this worked and this didn't" is welcome too).

Note that kubeclient uses 2 libs — http for watches and rest-client for all other requests. rest-client is based on ruby's core Net::HTTP, http gem isn't.
IIUC the rest-client test you link, it tests that rest-client respects $http_proxy by default but programmatic proxy: nil can override it. It doesn't meaningfully test no_proxy.

Collaborator

cben commented Mar 4, 2018

Thanks. Can you help us map out the current situation? A PR with just tests for current kubeclient behavior would be wonderful (but manual "this worked and this didn't" is welcome too).

Note that kubeclient uses 2 libs — http for watches and rest-client for all other requests. rest-client is based on ruby's core Net::HTTP, http gem isn't.
IIUC the rest-client test you link, it tests that rest-client respects $http_proxy by default but programmatic proxy: nil can override it. It doesn't meaningfully test no_proxy.

@cben

This comment has been minimized.

Show comment
Hide comment
@cben

cben Mar 4, 2018

Collaborator

Also, is current kubeclient API adequate if you're willing to parse env vars yourself?
https://github.com/abonas/kubeclient#proxies — you can set http_proxy_uri but can't specify a no_proxy set of hosts, right?
Ooh, this seems useful: https://ruby-doc.org/stdlib-2.2.0/libdoc/uri/rdoc/URI/Generic.html#method-i-find_proxy

Are these env vars standardized anywhere? I found https://wiki.archlinux.org/index.php/proxy_settings, sounds more like convention than standard.

P.S. found that Net::HTTP.new recently gained no_proxy param (but already supported no_proxy env var): https://bugs.ruby-lang.org/issues/11195

Collaborator

cben commented Mar 4, 2018

Also, is current kubeclient API adequate if you're willing to parse env vars yourself?
https://github.com/abonas/kubeclient#proxies — you can set http_proxy_uri but can't specify a no_proxy set of hosts, right?
Ooh, this seems useful: https://ruby-doc.org/stdlib-2.2.0/libdoc/uri/rdoc/URI/Generic.html#method-i-find_proxy

Are these env vars standardized anywhere? I found https://wiki.archlinux.org/index.php/proxy_settings, sounds more like convention than standard.

P.S. found that Net::HTTP.new recently gained no_proxy param (but already supported no_proxy env var): https://bugs.ruby-lang.org/issues/11195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment