Problems with Net::HTTP.get

M

Marek Kubica

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
 
B

Brock Weaver

------=_Part_2643_29912293.1123785581048
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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

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

hth...



=20
Hello!
=20
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 mad= e
a smaller version of the program which shows the same problem:
=20
The code is:
=20
require 'net/http'
require 'uri'
source =3D Net::HTTP.get(URI.parse('http://www.google.de/'))
puts source
=20
Looks pretty basic. But the problem is: it never gets to the last line! I= t
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:
=20
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
=20
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 t= o
work on Windows?
=20
Thanks in advance!
=20
Marek
=20
=20
=20


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

------=_Part_2643_29912293.1123785581048--
 
M

Marek Kubica

Hello!

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

greets,
Marek
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top