From: Eric Hodel Date: 2006-07-20T06:23:22+09:00 Subject: Re: Net/HTTP is flaky? On Jul 19, 2006, at 1:20 PM, Just Another Victim of the Ambient Morality wrote: > "Logan Capaldo" wrote in message > news:70EBC0F7-3357-4DCD-BF2F-3BD0FBBAE92F@gmail.com... >>> Now, I do have access to a Linux system with Ruby 1.6 and it >>> sometimes >>> succeeds but often fails with this error: >>> >>> >>> /usr/lib/ruby/1.6/net/protocol.rb:221:in `error!': 403 "Forbidden" >>> (Net::ProtoFatalError) >>> from /usr/lib/ruby/1.6/net/http.rb:1217:in `value' >>> from /usr/lib/ruby/1.6/net/http.rb:605:in `get' >>> from ./web.rb:16 >>> >>> >>> How is this possible? How can it sometimes succeed and >>> sometimes >>> fail? >>> Why can't this reliably work? >>> Thank you... >>> >> It doesn't reliably work because this is the internet. Also the >> particular error you are seeing means that the webserver has >> forbidden >> access to the url you are trying to, um, access. > > But I can access the page just fine with a web browser. For instance, > go to "/" at "en.wikipedia.org" and it will reliably work with a > browser. No, it redirects to /wiki/Main_Page > Try it with Ruby and it will usually fail, although I did get it to > work > occasionally, last night, which I don't get. $ ruby -rnet/http Net::HTTP.start 'en.wikipedia.org' do |http| res = http.get '/'; p res; end # Matches browser behavior. > Hell, "/" at "music.com" has _never_ worked and there doesn't > appear to > be any kind of redirect or anything. $ ruby -rnet/http Net::HTTP.start 'music.com' do |http| res = http.get '/'; p res; end # Redirects to www.music.com in the browser, Net::HTTP matches browser behavior. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com