Problems with Net/HTTP

M

Matt T.

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)
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/')", 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 .

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
 
M

Matt T.

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
 
M

Matt T.

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
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top