Problems with Net::HTTP.get

(Marek Kubica) #1

Hello!

I've been happily writing a smaller program in Ruby (I can't write bigger
programs, as I'm just starting with Ruby) when a problem hit me. So I made
a smaller version of the program which shows the same problem:

The code is:

require 'net/http'
require 'uri'
source = Net::HTTP.get(URI.parse('http://www.google.de/'))
puts source

Looks pretty basic. But the problem is: it never gets to the last line! It
hangs on the Net::HTTP.get. I've also tried Net::FTP and it hasn't worked
either. I guess it could be a problem with socket.so, that's why I tested
multible versions of the Ruby interpreter:

1.8.1-mswin32: does not work
1.8.1-mingw32: does not work
1.8.2-mswin32: does not work
1.8.2-mingw32: does not work
1.8.2-one-click-installer(mswin32): does not work

I've tried this on Windows XP SP2 and it does not work, but on my Debian
Sarge box it works without any problem. Can somebody help me getting it to
work on Windows?

Thanks in advance!

Marek

(Brock Weaver) #2

Are you behind a proxy? If so there's an overload for HTTP.get...

source = Net::HTTP.get(URI.parse('http://www.google.de/'),
"proxy.server.here", 80) <http://www.google.de/'))>

hth...

···

On 8/11/05, Marek Kubica <pythonmailing@web.de> wrote:

Hello!

I've been happily writing a smaller program in Ruby (I can't write bigger
programs, as I'm just starting with Ruby) when a problem hit me. So I made
a smaller version of the program which shows the same problem:

The code is:

require 'net/http'
require 'uri'
source = Net::HTTP.get(URI.parse('http://www.google.de/'))
puts source

Looks pretty basic. But the problem is: it never gets to the last line! It
hangs on the Net::HTTP.get. I've also tried Net::FTP and it hasn't worked
either. I guess it could be a problem with socket.so, that's why I tested
multible versions of the Ruby interpreter:

1.8.1-mswin32: does not work
1.8.1-mingw32: does not work
1.8.2-mswin32: does not work
1.8.2-mingw32: does not work
1.8.2-one-click-installer(mswin32): does not work

I've tried this on Windows XP SP2 and it does not work, but on my Debian
Sarge box it works without any problem. Can somebody help me getting it to
work on Windows?

Thanks in advance!

Marek

--
Brock Weaver
http://www.circaware.com

(Marek Kubica) #3

Hello!

···

On Fri, 12 Aug 2005 03:39:44 +0900 Brock Weaver wrote:

Are you behind a proxy? If so there's an overload for HTTP.get...

source = Net::HTTP.get(URI.parse('http://www.google.de/'),
"proxy.server.here", 80) <http://www.google.de/'))>

No, I'm not. I've even started Packetyzer, a sniffer based on Ethereal and
looked into the packet data: The request is send, the response is 200 (OK)
and the HTML is being sent. But instead of displaying the data, my program
simply hangs :frowning:

greets,
Marek

(Ryan Leavengood) #4

Marek Kubica said:

No, I'm not. I've even started Packetyzer, a sniffer based on Ethereal and
looked into the packet data: The request is send, the response is 200 (OK)
and the HTML is being sent. But instead of displaying the data, my program
simply hangs :frowning:

There is a known problem caused by the ZoneAlarm firewall software on
Windows. If you are using that you must uninstall it for Ruby's sockets to
work correctly.

See the following for more info:

http://www.ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-talk/147717

Ryan

(Marek Kubica) #5

I do not use ZoneAlarm, I've got Panda. Hmm, disabling it does not help. I
should try uninstalling it :confused:

Btw: why there aren't any good personal firewalls for Windows which do not
conflict with half the software installed?

greets,
Marek

···

On Fri, 12 Aug 2005 06:02:56 +0900 Ryan Leavengood wrote:

There is a known problem caused by the ZoneAlarm firewall software on
Windows. If you are using that you must uninstall it for Ruby's sockets to
work correctly.

(W. James) #6

Ryan Leavengood wrote:

There is a known problem caused by the ZoneAlarm firewall software on
Windows. If you are using that you must uninstall it for Ruby's sockets to
work correctly.

Just tried the o.p.'s program under windoze 2000 with ZoneAlarm active.
When the window popped up asking whether Ruby should be allowed to
access the internet, I clicked "Yes". The Ruby program then printed
the html from Google.

So ZoneAlarm seems to be compatible with Ruby.

(Marek Kubica) #7

Many thanks Ryan, with the firewall uninstalled it works without problems.

Let's have a look at the bugs of other firewalls :wink:

greets and thanks,
Marek

···

On Thu, 11 Aug 2005 23:20:40 +0200 Marek Kubica wrote:

I do not use ZoneAlarm, I've got Panda. Hmm, disabling it does not help. I
should try uninstalling it :confused:

(Ryan Leavengood) #8

Marek Kubica said:

Many thanks Ryan, with the firewall uninstalled it works without problems.

Let's have a look at the bugs of other firewalls :wink:

No problem, I'm glad I could help.

It is a real shame that firewall software can have this affect, since it
is an important piece of software to have these days (especially on a
Windows machine.)

I can only hope that ZoneAlarm and Panda are the only ones with this
problem, and other firewalls can coexist with Ruby. Does anyone have a
list of firewall software that DO work with Ruby? Or rather, who has a
firewall installed and Ruby sockets are still working?

Ryan

(Tom Reilly) #9

I've used Macafee, AVG Virus scan with firewall and Norton and have had no trouble using html with Ruby. Zone Alarm would not work
I uninstalled the program. I use Windows 2000 Professional.

Ryan Leavengood wrote:

···

Marek Kubica said:

Many thanks Ryan, with the firewall uninstalled it works without problems.

Let's have a look at the bugs of other firewalls :wink:
   
No problem, I'm glad I could help.

It is a real shame that firewall software can have this affect, since it
is an important piece of software to have these days (especially on a
Windows machine.)

I can only hope that ZoneAlarm and Panda are the only ones with this
problem, and other firewalls can coexist with Ruby. Does anyone have a
list of firewall software that DO work with Ruby? Or rather, who has a
firewall installed and Ruby sockets are still working?

Ryan

(Matt Mower) #10

I was using Kerio Personal Firewall on WinXP-SP1 and don't remember
having problems using Net:HTTP.

M

···

On 8/11/05, Ryan Leavengood <mrcode@netrox.net> wrote:

I can only hope that ZoneAlarm and Panda are the only ones with this
problem, and other firewalls can coexist with Ruby. Does anyone have a
list of firewall software that DO work with Ruby? Or rather, who has a
firewall installed and Ruby sockets are still working?

--
Matt Mower :: http://matt.blogs.it/

(Marek Kubica) #11

I've first installed Agnitum Outpost Free (1.0) and that worked with Ruby.
But since it was rather old and wanted to force me to upgrade to V2 (and
pay for it) I removed it. But still: it works with Ruby!

Later I tried Sygate Personal Firewall (Standard) 5.6, and it also works
with Ruby. I think I'll stay with this, it seems to be okay.

And the Panda anit-virus was replaced with free avast which works better.
Thanks to Ruby I've found time to switch to better software, great! :slight_smile:

greets,
Marek

···

On Fri, 12 Aug 2005 06:56:55 +0900 Ryan Leavengood wrote:

I can only hope that ZoneAlarm and Panda are the only ones with this
problem, and other firewalls can coexist with Ruby. Does anyone have a
list of firewall software that DO work with Ruby? Or rather, who has a
firewall installed and Ruby sockets are still working?

(W. James) #12

Ryan Leavengood wrote:

I can only hope that ZoneAlarm and Panda are the only ones with this
problem, and other firewalls can coexist with Ruby. Does anyone have a
list of firewall software that DO work with Ruby? Or rather, who has a
firewall installed and Ruby sockets are still working?

The other computer that didn't have this
problem had the same winxp and ZoneAlarm updates, except that I
had the paid version and he had the free version.

Under widoze 2000, the free version of ZoneAlarm doesn't block Ruby.
The o.p.'s program works correctly on my computer when ZoneAlarm
is active.

···

At http://www.ruby-talk.org/cgi-b in/scat.rb/ruby/ruby-talk/147717 Ezra wrote:

(James Britt) #13

Ryan Leavengood wrote:

Marek Kubica said:

Many thanks Ryan, with the firewall uninstalled it works without problems.

Let's have a look at the bugs of other firewalls :wink:

No problem, I'm glad I could help.

It is a real shame that firewall software can have this affect, since it
is an important piece of software to have these days (especially on a
Windows machine.)

I can only hope that ZoneAlarm and Panda are the only ones with this
problem, and other firewalls can coexist with Ruby. Does anyone have a
list of firewall software that DO work with Ruby? Or rather, who has a
firewall installed and Ruby sockets are still working?

I have ZoneAlarm freebie version on multiple machines, a mix of Win2k and WinXP, and have never had an issue with Ruby Net access.

James

···

--

http://www.ruby-doc.org - The Ruby Documentation Site
http://www.rubyxml.com - News, Articles, and Listings for Ruby & XML
http://www.rubystuff.com - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com - Playing with Better Toys