Setting an HTTP Timeout in Ruby 1.9.3
问题 I'm using Ruby 1.9.3 and need to GET a URL. I have this working with Net::HTTP , however, if the site is down, Net::HTTP ends up hanging. While searching the internet, I've seen many people faced similar problems, all with hacky solutions. However, many of those posts are quite old. Requirements: I'd prefer using Net::HTTP to installing a new gem. I need both the Body and the Response Code. (e.g. 200) I do not want to require open-uri , since that makes global changes and raises some security