# Problems with Net/HTTP

**URL:** <https://www.ruby-forum.com/t/problems-with-net-http/96702>\
**Category:** Ruby\
**Created:** [January 24, 2006, 6:11pm UTC](https://www.ruby-forum.com/t/problems-with-net-http/96702 "2006-01-24T18:11:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [January 24, 2006, 6:11pm UTC](https://www.ruby-forum.com/t/problems-with-net-http/96702/1 "2006-01-24T18:11:25Z")

</div>

Good evening,

I’m having problems with Net/HTTP, in that it never seems to be able to  
complete a connection. I posted about a related problem a little bit  
ago  
([http://groups.google.com/group/comp.lang.ruby/browse\_thread/thread/78e12ac0a2a23f7b/696843dea30f1647](http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/78e12ac0a2a23f7b/696843dea30f1647))  
but I didn’t solve the problem, and since then I’ve narrowed down the  
cause.

> From looking at Ethereal, it seems like the file is being downloaded  
> completely, but the connection never seems to end (or at least Net/HTTP  
> never recognizes it as ending.) When I try a simple  
> “Net::HTTP.get\_print URI.parse(‘[http://www.google.com/](http://www.google.com/)’)”, Ruby hangs  
> with no output and the aforementioned network activity. Even CTRL+C  
> wont end it, I have to close the cmd.exe instance to get it to end. I  
> have an Ethereal capture of the data in questions here(libpcap format):  
> [http://www.overblown.net/nethttp\_problem.cap](http://www.overblown.net/nethttp_problem.cap) .

I’m running Windows XP Pro SP2 with One-Click Ruby 1.8.2-15. It’s a  
fairly fresh install of both products, too. I’ve tried uninstalling and  
then re-installing Ruby, with no luck. I’m behind a Linux NAT gateway,  
but I doubt that’s the trouble since every other network device behind  
it is operating fine, and my old computer used to run Net/HTTP just  
fine behind the very same gateway. So far as I can tell, Ruby is the  
only thing having any sort of trouble. There is nothing of note or out  
of the ordinary about my machine I can think of. It’s a vanilla Windows  
install, a vanilla Ruby install and, like I said, my old computer with  
the same network connection, NIC, IP address and everything else ran  
Ruby just fine.

I’m really stumped as to what can be going wrong. And since Net/HTTP is  
a C extension, it’s difficult to debug for me. Does anybody have any  
idea what’s going wrong or how can I fix it?

Thank you for your help,  
-Matt

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [January 26, 2006, 2:49am UTC](https://www.ruby-forum.com/t/problems-with-net-http/96702/2 "2006-01-26T02:49:15Z")

</div>

OK, after much time with the my editor debugger and STDERR, I’ve  
narrowed this down as far as I can get it. It turns out that  
TCPSocket#write is the ultimate method that is hanging. Net/HTTP calls  
that and it never returns. Does anybody know why this might be?

I’m not using any proxies, nor local firewall software or anything else  
that I could think of that would mess with my network stack.

Right now I’m holding off elevating this bug since I’m using 1.8.2 and  
there’s a slight chance that 1.8.4 will fix this, but I’d rather not  
have to put off any network-oriented Ruby coding until then. I’d really  
love some help with this, it’s a very vexing problem.

-Matt

---

<div class="post-metadata">

**Author:** ![maraby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f08c70/32.png) [@maraby](https://www.ruby-forum.com/u/maraby)\
**Post date:** [February 2, 2006, 12:02am UTC](https://www.ruby-forum.com/t/problems-with-net-http/96702/3 "2006-02-02T00:02:00Z")

</div>

Fixed!

I just wanted to get this into the archives, in case anybody else has  
this same problem later. It turns out that PGP Desktop 9, of all  
things, was causing problems. PGP Desktop 9 installs a Winsock 2  
service to allow it to do on-the-fly IM and e-mail encryption without  
interacting with IM and e-mail applications. Even though I had the  
option to do this encryption turned off, it was still interfering with  
Ruby.

The fix is to use LSP-Fix (available from  
[LSP-Fix - a free program to repair damaged Winsock 2 stacks](http://www.cexx.org/lspfix.htm) ) to get rid of the PGPISP.dll (I  
believe that’s the exact name – the DLL doesn’t show up once removed)  
service from your Winsock stack. Click on the “I know what I’m doing”  
check-box, move said DLL to the right hand column and then click  
“Finish”. Ruby should start working from then on.

I’m still doing research to make sure everything came out OK. I’ll  
update this thread if I more information comes to light.

-Matt
