# Gems, Proxy authentication

**URL:** <https://rubytalk.org/t/gems-proxy-authentication/48628>\
**Category:** ruby-talk\
**Created:** [26 August 2008 15:38 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628 "2008-08-26T15:38:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_T](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@John\_T](https://rubytalk.org/u/John_T)\
**Post date:** [26 August 2008 15:38 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/1 "2008-08-26T15:38:19Z")

</div>

Hello.. My company recently changed to a new proxy server and now my gem  
update commands aren't working. Doing a gem update gives me:

Updating installed gems  
ERROR: While executing gem ... (Zlib::BufError)  
&nbsp;&nbsp;&nbsp;&nbsp;buffer error

I searched and found the rubysspi gem  
([http://rubyforge.org/projects/rubysspi/](http://rubyforge.org/projects/rubysspi/)  
). I installed it and configured as per the directions and set my  
http\_proxy environment var:

set http\_proxy=http://192.168.4.3:3128

(I also edited the gem.bat command to automatically include the library  
-rspa)

But now I get:

Updating installed gems  
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)  
&nbsp;&nbsp;&nbsp;&nbsp;bad response Proxy Authentication Required 407  
([http://gems.rubyforge.org/la](http://gems.rubyforge.org/la)  
test\_specs.4.8)

I'm not sure what the problem is or what to do to fix! Justin Bailey you  
out there?

Thanks!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![John\_T](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@John\_T](https://rubytalk.org/u/John_T)\
**Post date:** [26 August 2008 15:52 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/2 "2008-08-26T15:52:50Z")

</div>

John T. wrote:

> Hello.. My company recently changed to a new proxy server and now my gem  
> update commands aren't working.

Small update. I tried running the gem command like this:

ruby -rspa c:\ruby\bin\gem update

and it returns:

Updating installed gems  
ERROR: While executing gem ... (RuntimeError)  
&nbsp;&nbsp;&nbsp;&nbsp;Error occurred during proxy negotiation. req: "NTLM  
TlRMTVNTUAABAAAAt4II4gAA  
AAAAAAAAAAAAAAAAAAAFASgKAAAADw=="; res:  
#\<Net::HTTPProxyAuthenticationRequired 4  
07 Proxy Authentication Required readbody=true\>; Original message:  
Error: SEC\_E\_  
INVALID\_TOKEN

Yeah, not any better...

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Zhoran\_Tvalve](https://avatars.discourse-cdn.com/v4/letter/z/e480ec/32.png) [@Zhoran\_Tvalve](https://rubytalk.org/u/Zhoran_Tvalve)\
**Post date:** [10 December 2008 11:20 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/3 "2008-12-10T11:20:19Z")

</div>

John T. wrote:

> Hello.. My company recently changed to a new proxy server and now my gem  
> update commands aren't working. Doing a gem update gives me:
> 
> Updating installed gems  
> ERROR: While executing gem ... (Zlib::BufError)  
> &nbsp;&nbsp;&nbsp;&nbsp;buffer error
> 
> I searched and found the rubysspi gem  
> ([http://rubyforge.org/projects/rubysspi/](http://rubyforge.org/projects/rubysspi/)  
> ). I installed it and configured as per the directions and set my  
> http\_proxy environment var:
> 
> set http\_proxy=[http://192.168.4.3:3128](http://192.168.4.3:3128)
> 
> (I also edited the gem.bat command to automatically include the library  
> -rspa)
> 
> But now I get:
> 
> Updating installed gems  
> ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)  
> &nbsp;&nbsp;&nbsp;&nbsp;bad response Proxy Authentication Required 407  
> ([RubyGems.org | your community gem host](http://gems.rubyforge.org/la)  
> test\_specs.4.8)
> 
> I'm not sure what the problem is or what to do to fix! Justin Bailey you  
> out there?
> 
> Thanks!

Hi, me too ☹  
I set http\_proxy environment var and after executing

> gem list -r

I got:  
\*\*\* REMOTE GEMS\*\*\*  
Error: While executing gem ... (Gem::RemoteSourceException)  
&nbsp;&nbsp;&nbsp;HTTP Responce 407

can you help me to overcome that evil proxy?  
Is there a gem with topnotch proxy support?

Thank you for your attention.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![John\_T](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@John\_T](https://rubytalk.org/u/John_T)\
**Post date:** [10 December 2008 14:49 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/4 "2008-12-10T14:49:39Z")

</div>

Zhoran Tvalve wrote:

> Hi, me too ☹  
> I set http\_proxy environment var and after executing
> 
> > gem list -r
> 
> I got:  
> \*\*\* REMOTE GEMS\*\*\*  
> Error: While executing gem ... (Gem::RemoteSourceException)  
> &nbsp;&nbsp;&nbsp;HTTP Responce 407
> 
> can you help me to overcome that evil proxy?  
> Is there a gem with topnotch proxy support?
> 
> Thank you for your attention.

I was finally able to get it to work by including the username and  
password in the environment var:

HTTP\_PROXY=[http://username:password@192.168.4.4:1234](http://username:password@192.168.4.4:1234)

(replace username, password and proxy address/port as necessary)

that made it work. I just have to remember to change it when I have to  
change my password, every 90 days...

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Zhoran\_Tvalve](https://avatars.discourse-cdn.com/v4/letter/z/e480ec/32.png) [@Zhoran\_Tvalve](https://rubytalk.org/u/Zhoran_Tvalve)\
**Post date:** [10 December 2008 15:11 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/5 "2008-12-10T15:11:53Z")

</div>

John T. wrote:

> I was finally able to get it to work by including the username and  
> password in the environment var:
> 
> HTTP\_PROXY=[http://username:password@192.168.4.4:1234](http://username:password@192.168.4.4:1234)
> 
> (replace username, password and proxy address/port as necessary)
> 
> that made it work. I just have to remember to change it when I have to  
> change my password, every 90 days...

Hi, John!  
So did I, but unsuccessful ☹  
Stil got err 407 auth required

Tryied to set http\_proxy = 'domain\username:password@192.168.1.32:3128'  
but uri\common.rb reported BAD URI ...

setting http\_proxy = 'domain\\username:password@192.168.1.32:3128' makes  
the same

I work with:

&nbsp;&nbsp;&nbsp;Ruby Installer for Windows  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ruby Version 1.8.6  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Installer Version 186-25

> **···**
>
> ------------------------------  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RELEASE NOTES  
> ------------------------------
> 
> Contents: Version:  
> -------- --------
> 
> ruby-mswin32 ruby-1.8.6  
> zlib-lib 1.2.3  
> ZLib 0.6.0  
> RubyGems 0.9.2  
> Rake 0.7.2  
> RubySrc 1.8.6  
> FXRuby 1.6.6  
> FXri 0.3.6  
> SciTE 1.72  
> OpenGL 0.23b  
> GLUT 3.7.6  
> SWin 060205  
> VRuby 060223  
> Expat 2.0.0  
> XMLParser 0.6.8  
> Hpricot 0.4  
> RubyDBI 0.1.1  
> DBD/ODBC 0.9994  
> windows-pr 0.6.2  
> win32-file-stat 1.2.3  
> win32-file 0.5.3  
> win32-clipboard 0.4.1  
> win32-dir 0.3.1  
> win32-eventlog 0.4.3  
> win32-process 0.5.1  
> win32-sapi 0.1.3  
> win32-sound 0.4.0  
> log4r 1.0.5  
> Programming Ruby 1st Edition  
> OpenSSL 0.9.8d  
> Iconv 1.8  
> readline 4.3-2  
> PDCurses 2.60-1  
> GDBM 1.8.3-1  
> Installer-Patches 1.8.5
> 
> what is yours?  
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Zhoran\_Tvalve](https://avatars.discourse-cdn.com/v4/letter/z/e480ec/32.png) [@Zhoran\_Tvalve](https://rubytalk.org/u/Zhoran_Tvalve)\
**Post date:** [10 December 2008 15:36 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/6 "2008-12-10T15:36:19Z")

</div>

Zhoran Tvalve wrote:

> John T. wrote:  
> Tryied to set http\_proxy = 'domain\username:password@192.168.1.32:3128'  
> but uri\common.rb reported BAD URI ...

sorry, shure actually they were  
'[http://username:password@192.168.1.32:3128](http://username:password@192.168.1.32:3128)'  
'[http://domain\username:password@192.168.1.32:3128](http://domain%5Cusername:password@192.168.1.32:3128)'  
'[http://domain\\username:password@192.168.1.32:3128](http://domain%5C%5Cusername:password@192.168.1.32:3128)'

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [11 December 2008 18:44 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/7 "2008-12-11T18:44:01Z")

</div>

Ruby does not support NTLM authentication by default which is what your proxy probably uses. Maybe this will help: [http://rubyforge.org/projects/rubyntlm/](http://rubyforge.org/projects/rubyntlm/)

> **···**
>
> On Dec 10, 2008, at 07:11 AM, Zhoran Tvalve wrote:
> 
> > John T. wrote:
> > 
> > > I was finally able to get it to work by including the username and  
> > > password in the environment var:
> > > 
> > > HTTP\_PROXY=[http://username:password@192.168.4.4:1234](http://username:password@192.168.4.4:1234)
> > > 
> > > (replace username, password and proxy address/port as necessary)
> > > 
> > > that made it work. I just have to remember to change it when I have to  
> > > change my password, every 90 days...
> > 
> > Hi, John!  
> > So did I, but unsuccessful ☹  
> > Stil got err 407 auth required
> > 
> > Tryied to set http\_proxy = 'domain\username:password@192.168.1.32:3128'  
> > but uri\common.rb reported BAD URI ...
> > 
> > setting http\_proxy = 'domain\\username:password@192.168.1.32:3128' makes  
> > the same

---

<div class="post-metadata">

**Author:** ![John\_T](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@John\_T](https://rubytalk.org/u/John_T)\
**Post date:** [11 December 2008 15:45 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/8 "2008-12-11T15:45:44Z")

</div>

Hm. Not sure. The first one you list below did work for me. I didn't  
have to include the domain.

Try typing the 'env' command to list the environment variables - there  
is one defined for me:

USERDOMAIN=mydomain

It should already be set, and I don't know if that's used. Also I did  
install that rubysspi gem, but am not sure if that's helping or not...

Zhoran Tvalve wrote:

> **···**
>
> > Zhoran Tvalve wrote:
> > 
> > > John T. wrote:  
> > > Tryied to set http\_proxy = 'domain\username:password@192.168.1.32:3128'  
> > > but uri\common.rb reported BAD URI ...
> > 
> > sorry, shure actually they were  
> > '[http://username:password@192.168.1.32:3128](http://username:password@192.168.1.32:3128)'  
> > '[http://domain\username:password@192.168.1.32:3128](http://domain%5Cusername:password@192.168.1.32:3128)'  
> > '[http://domain\\username:password@192.168.1.32:3128](http://domain%5C%5Cusername:password@192.168.1.32:3128)'
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Zhoran\_Tvalve](https://avatars.discourse-cdn.com/v4/letter/z/e480ec/32.png) [@Zhoran\_Tvalve](https://rubytalk.org/u/Zhoran_Tvalve)\
**Post date:** [15 December 2008 07:24 UTC](https://rubytalk.org/t/gems-proxy-authentication/48628/9 "2008-12-15T07:24:08Z")

</div>

Eric Hodel wrote:

> **···**
>
> > On Dec 10, 2008, at 07:11 AM, Zhoran Tvalve wrote:
> > 
> > > > change my password, every 90 days...
> > > 
> > > makes  
> > > the same
> > 
> > Ruby does not support NTLM authentication by default which is what  
> > your proxy probably uses. Maybe this will help:  
> > [http://rubyforge.org/projects/rubyntlm/](http://rubyforge.org/projects/rubyntlm/)
> 
> Hi, John.  
> I found out that proxy I had trouble with use ntlm authentication  
> indeed. I tested gem against the other proxy which accepts both ntlm and  
> basic authentication and it let gem through. I use env var http\_proxy  
> with user and password set as you suggested Eric. Thank you guys! My  
> trouble is over 🙂  
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
