Skip to content

Instantly share code, notes, and snippets.

@gkop
Created April 18, 2014 23:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gkop/11068928 to your computer and use it in GitHub Desktop.
Save gkop/11068928 to your computer and use it in GitHub Desktop.
require "net/http"
require "uri"
module Net
class HTTP
alias old_initialize initialize
def initialize(*args)
old_initialize(*args)
@open_timeout = @read_timeout = 1 # 1 second
end
end
end
uri = URI.parse("http://www2.census.gov/geo/tiger/TIGER2013/UAC/tl_2013_us_uac10.zip")
http = Net::HTTP.new(uri.host, uri.port)
response = http.request(Net::HTTP::Get.new(uri.request_uri))
puts response.code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment