Forum: Rails-core (closed, excessive spam) script\plugin discover fails with '407 Proxy Authentication Required'

Posted by Thomas Sonntag (Guest)
on 2007-10-17 11:58
(Received via mailing list)
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
Posted by Michael Koziarski (Guest)
on 2007-10-19 04:40
(Received via mailing list)
> 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.

--
Cheers

Koz
Posted by John Howard (Guest)
on 2007-11-12 17:19
(Received via mailing list)
Does anyone have an answer to this question? I am having the same
issue.

Thanks,
John
Posted by Nick Chistyakov (kolach)
on 2007-11-13 12:21
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!
Posted by John Howard (Guest)
on 2007-11-13 14:47
(Received via mailing list)
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-
Posted by Nick Chistyakov (kolach)
on 2007-11-13 18:29
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!
Posted by Michael Johann (Guest)
on 2007-12-10 15:34
(Received via mailing list)
Hi John,

have you tried to configure your proxy parameters in <HOME-
DIRECTORY>/.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
Posted by Thato Mantai (xyzstarr)
on 2008-02-06 14:34
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
Posted by blim8183 (Guest)
on 2008-08-28 21:15
(Received via mailing list)
I realize it's been a long time since this thread has ended but what
version of ruby is this for? I've run into this problem recently but
I'm not finding anything in my open-uri.rb file that looks anything
like the bits of code here...

On Nov 13 2007, 7:21 am, Nick Chistyakov <ruby-forum-incom...@andreas-
This topic is locked and can not be replied to.