On Jul 19, 2006, at 4:55 PM, Just Another Victim of the Ambient
was giving me a redirect and if I knew how to follow one were I to
Well, if you expect to use Net::HTTP you need to know both HTTP and
the library. You might prefer WWW::Mechanize instead.
You’ll get Top Quality Answers if you tell us what you really want to
do. Help with the intricacies of a library may not let us guide you
down the right path
$ ruby -rnet/http
Net::HTTP.start ‘en.wikipedia.org’ do |http| res = http.get ‘/’; p
#<Net::HTTPMovedPermanently 301 Moved Permanently readbody=true>
That shows Net::HTTP returning a redirect when you perform a get.
This behaviour doesn’t match my browser. Is there any way I can
get redirected or find out where it wants to redirect me and go
Follow the redirect. Look at open-uri for example code.
You know, this is where Ruby’s lack of documentation is really
biting me in the ass. I found some rudimentary docs on how to use
it but, you know what?
Unfortunately the Net::HTTP documentation isn’t enabled in 1.8. You
can use the 1.9 documentation however:
As luck would have it, it has a “Following Redirection” section a few
For the life of me, no amount of googling can reveal exactly where
I can get the open-uri module… Seriously, where do I download
this thing from and how could I have known that?
It ships with ruby, require ‘open-uri’.
Thank you, from a very frustrated would-be Ruby programmer…
I’ve been working on getting lots more documentation enabled in 1.8.
I hope to get the net/ stuff turned on, but I don’t know if I’ll have
enough time to review/merge documentation from HEAD. (I’d really,
really like help with this, and Hugh S. has brought in a ton of
Eric H. - [email protected] - http://blog.segment7.net
This implementation is HODEL-HASH-9600 compliant