On Jul 19, 2006, at 7:50 AM, Just Another Victim of the Ambient  
Morality wrote:

>     Inexplicably, the following code fails:
>
>
> http = Net::HTTP.new("somesite.com")
> puts http.get("/")[1]
>
>
>     ...with this error:
>
>
> ruby/1.8/net/http.rb:925:in '[]': undefined method 'downcase' for  
> 1:Fixnum
> (NoMethodError)
>         from web.rb:5
>

The interface to Net::HTTP changed between 1.6 and 1.8
You want
http.get('/').body

>
>     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.


>
>