Chillibear
A place for notes about stuff

Archive for December 2010

Ruby Net/HTTP not respecting timeout

One that caught me out for a while … needed to reduce the timeout the Net/HTTP library was defaulting to because the servers I was querying were liable to be offline and I didn’t want my script hanging around. I wrote something like: require ‘net/http’ res = Net::HTTP.start(‘http://www.example.com’) do |http| http.open_timeout = 4 http.read_timeout = [...]