Skip to content
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

Change how ruby proxy is invoked. #280

Merged
merged 1 commit into from
Aug 2, 2017
Merged

Conversation

nanliu
Copy link
Contributor

@nanliu nanliu commented May 6, 2017

No description provided.

@@ -48,7 +53,7 @@ def follow_redirect(uri, option = { limit: FOLLOW_LIMIT }, &block)
else
{ use_ssl: false }
end
Net::HTTP.start(uri.host, uri.port, http_opts) do |http|
Net::HTTP.start(uri.host, uri.port, http_opts, @proxy_addr, @proxy_port) do |http|
Copy link

@TeunRoefs TeunRoefs May 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanliu Almost there, changing Net::HTTP.start(uri.host, uri.port, http_opts, @proxy_addr, @proxy_port) to Net::HTTP.start(uri.host, uri.port, @proxy_addr, @proxy_port, http_opts) will fix the issue on Windows.

See: https://docs.ruby-lang.org/en/2.0.0/Net/HTTP.html#method-c-start

@TeunRoefs
Copy link

@nanliu Ready for merge I guess? Is there anything I need to do?

@TeunRoefs
Copy link

Any update on this PR, kinda need this functionality and do not want to fork the module.

@alexjfisher
Copy link
Member

LGTM

alex@phantom:~$ cat test.pp
archive { '/tmp/afisher.test':
  ensure       => present,
  source       => 'https://github.com/voxpupuli/puppet-archive/archive/master.zip',
  cleanup      => false,
  extract      => false,
  proxy_server => 'http://localhost:3128',
  provider     => 'ruby',
}

alex@phantom:~$ sudo tail /var/log/squid/access.log
alex@phantom:~$ rm /tmp/afisher.test ;puppet apply -t test.pp; sudo tail /var/log/squid/access.log
Info: Loading facts
Info: Loading facts
Notice: Compiled catalog for phantom in environment production in 0.13 seconds
Info: Applying configuration version '1495047363'
Notice: /Stage[main]/Main/Archive[/tmp/afisher.test]/ensure: download archive from https://github.com/voxpupuli/puppet-archive/archive/master.zip to /tmp/afisher.test  without cleanup
Notice: Applied catalog in 1.22 seconds
1495047364.754    749 127.0.0.1 TCP_TUNNEL/200 232053 CONNECT codeload.github.com:443 - HIER_DIRECT/192.30.253.120 -
1495047364.754   1161 127.0.0.1 TCP_TUNNEL/200 6126 CONNECT github.com:443 - HIER_DIRECT/192.30.253.113 -

if options[:proxy_server]
uri = URI(options[:proxy_server])
unless uri.scheme
uri = URI("#{options[:proxy_type]}://#{options[:proxy_server]}")
Copy link
Member

@alexjfisher alexjfisher May 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should never be hit?

I still think we've got confusion about what proxy_type is supposed to do. Is it the scheme of the URL needing proxying, or the scheme of the proxy server URL? At the moment, the parameters behave differently depending on the provider.
According to the README and original proxy PR, proxy_server is supposed to be of the form http://my_proxy.example.com:3128 ? I think it's confusing to try and support multiple forms considering the already differing behaviour between providers.

@KZachariassen
Copy link

Could we get this merged and created a new release? - need this functionality

@edestecd
Copy link

I can confirm this works as well on windows...

@nanliu nanliu merged commit 5ec374f into voxpupuli:master Aug 2, 2017
cegeka-jenkins pushed a commit to cegeka/puppet-archive that referenced this pull request Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants