script\plugin discover fails with '407 Proxy Authentication Required'

I am running rails 1.2.57919 on windows.
I access the internet via a http proxy; the env variable http_proxy is
set to http://user:password@host:port
gem works fine with these settings.

However 'script\plugin discover' fails:

C:/Install/ruby/lib/ruby/1.8/open-uri.rb:287:in `open_http': 407 Proxy
Authentication Required (OpenURI::HTTPError)
  from C:/Install/ruby/lib/ruby/1.8/open-uri.rb:626:in `buffer_open'
  from C:/Install/ruby/lib/ruby/1.8/open-uri.rb:164:in `open_loop'
  from C:/Install/ruby/lib/ruby/1.8/open-uri.rb:162:in `catch'
  from C:/Install/ruby/lib/ruby/1.8/open-uri.rb:162:in `open_loop'
  from C:/Install/ruby/lib/ruby/1.8/open-uri.rb:132:in `open_uri'
  from C:/Install/ruby/lib/ruby/1.8/open-uri.rb:528:in `open'
  from C:/Install/ruby/lib/ruby/1.8/open-uri.rb:30:in `open'
  from C:/Install/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/plugin.rb:687:in `scrape'
  from C:/Install/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/plugin.rb:661:in `parse!'
  from C:/Install/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/plugin.rb:660:in `each'
  from C:/Install/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/plugin.rb:660:in `parse!'
  from C:/Install/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/plugin.rb:476:in `parse!'
  from C:/Install/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/plugin.rb:492:in `parse!'
  from C:/Install/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5.7919/lib/
commands/plugin.rb:923
  from C:/Install/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `gem_original_require'
  from C:/Install/ruby/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:27:in `require'
  from script/plugin:3

Any idea how to solve this ?

Thanks
Thomas

I am running rails 1.2.57919 on windows.
I access the internet via a http proxy; the env variable http_proxy is
set to http://user:password@host:port
gem works fine with these settings.

However 'script\plugin discover' fails:

I suppose that open-uri doesn't support proxies in this way? If you
can find out how to make it work, we could take patches to fix it.

Does anyone have an answer to this question? I am having the same
issue.

Thanks,
John

John Howard wrote:

Does anyone have an answer to this question? I am having the same
issue.

Thanks,
John

Ok, I'll try to explain what I did to make it work.
This `407 Proxy Authentication Required' happens because along with
proxy address
and proxy port two additional params must by supplied:
1. user
2. password

In open-uri.rb, method OpenURI.open_http, line 216 there is a record:
klass = Net::HTTP::Proxy(proxy.host, proxy.port)

The full signature of that Net::HTTP::Proxy(...) method is:
def Net::HTTP.Proxy(p_addr, p_port = nil, p_user = nil, p_pass = nil)
So just add proxy.user, proxy.password:

klass = Net::HTTP::Proxy(proxy.host, proxy.port, proxy.user,
proxy.password)

Note that your environment variable http_proxy must be set in a way it
described above (http_proxy=http://user:password@host:port)

At last, it worked for me!

Nick,

Thanks very much - that worked first time!!

If I could trouble you further though. I'm still having trouble
accessing plugins where the address is given svn://svn.etc.com

I have Subversion installed but every time I try to install from one
of these repositories it says (eg):

ruby script/plugin install svn://svn.seesaw.it/widgets/trunk
svn: Unknown hostname 'svn.seesaw.it'

It seems as though I have no DNS access for these addresses. HTTP ones
seem fine.

Apologies if I am not making sense - I'm a real novice!

Any help appreciated.
John

John Howard wrote:

Nick,

Thanks very much - that worked first time!!

If I could trouble you further though. I'm still having trouble
accessing plugins where the address is given svn://svn.etc.com

I have Subversion installed but every time I try to install from one
of these repositories it says (eg):

ruby script/plugin install svn://svn.seesaw.it/widgets/trunk
svn: Unknown hostname 'svn.seesaw.it'

It seems as though I have no DNS access for these addresses. HTTP ones
seem fine.

Apologies if I am not making sense - I'm a real novice!

Any help appreciated.
John

On Nov 13, 11:21 am, Nick Chistyakov <ruby-forum-incom...@andreas-

Hi John!
Sorry, but here I can't help you.
I can only guess -
It is likely that the access by svn protocol is disabled by your system
administrators. That's the way they usually configure their damned proxy
servers :(((. So the first thing you must do is to get in touch with
them.
Good luck!

Hi John,

have you tried to configure your proxy parameters in <HOME-

/.subversion/server ?

In the global section you can configure your proxy parameters. This is
what works for me with repositories, that are reachable via HTTP.
But, if you cannot use a URL with http://… for accessing a SVN
repository it may be, because you are behind a firewall that doesn't
allow you to contact port 2401.

Greetings
Michael

set http_proxy=http://username:password@proxy:port wouldn't work for me,
because my proxy password was something like "P@ssw0rd", so yah, there
you hae it. The @ sign in my password was the problem because I always
used to end up with URI::InvalidURIError. Nevertheless, I called the
technical guys and asked them to change my password since I can't change
it myself. It works. Thanks