A
Amit Bobade
Dear All:
I am trying to deal with the http response. I am using following code to
do so.
<code>
require 'net/http'
require 'uri'
def fetch(uri_str, limit = 10)
# You should choose better exception.
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
response = Net::HTTP.get_response(URI.parse(uri_str))
case response
when Net::HTTPSuccess then response
when Net::HTTPRedirection then fetch(response['location'], limit -
1)
else
response.error!
end
end
print fetch('http://www.gosocially.com/index.php')
</code>
I am getting output: #<Net::HTTPFound:0x29b78f8>
Please tell me what is the meaning of #<Net::HTTPFound:0x29b78f8> ?
Thanks,
Amit
I am trying to deal with the http response. I am using following code to
do so.
<code>
require 'net/http'
require 'uri'
def fetch(uri_str, limit = 10)
# You should choose better exception.
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
response = Net::HTTP.get_response(URI.parse(uri_str))
case response
when Net::HTTPSuccess then response
when Net::HTTPRedirection then fetch(response['location'], limit -
1)
else
response.error!
end
end
print fetch('http://www.gosocially.com/index.php')
</code>
I am getting output: #<Net::HTTPFound:0x29b78f8>
Please tell me what is the meaning of #<Net::HTTPFound:0x29b78f8> ?
Thanks,
Amit