On Jul 19, 2006, at 4:55 PM, Just Another Victim of the Ambient Morality wrote: > > "Eric Hodel" <drbrain / segment7.net> wrote in message > news:A270FB20-30C3-472C-8BA9-922490FFD19B / segment7.net... >> On Jul 19, 2006, at 2:55 PM, Just Another Victim of the Ambient >> Morality >> wrote: >> >> No, it doesn't fail, it gives you a redirect. Follow it. > > You know, it would be easier to follow the redirect if I knew > that it > was giving me a redirect and if I knew how to follow one were I to > be given > it... 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 :) Quoting myself: >> $ ruby -rnet/http >> Net::HTTP.start 'en.wikipedia.org' do |http| res = http.get '/'; p >> res; end >> #<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 >>> there, >>> myself? >> >> 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: http://ruby-doc.org/core-1.9/classes/Net/HTTP.html As luck would have it, it has a "Following Redirection" section a few pages down. > 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 Sasse has brought in a ton of new documentation.) -- Eric Hodel - drbrain / segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com