Skip to content

Instantly share code, notes, and snippets.

@osak
Created August 25, 2011 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osak/1171185 to your computer and use it in GitHub Desktop.
Save osak/1171185 to your computer and use it in GitHub Desktop.
Index: tco.rb
===================================================================
--- tco.rb (リビジョン 478)
+++ tco.rb (作業コピー)
@@ -24,7 +24,7 @@
end
def expand_url(url)
hash = Hash.new
- res = Net::HTTP.get_response(URI.parse(url))
+ res = Net::HTTP.get_response(URI.parse(url)) rescue nil
if res.is_a?(Net::HTTPRedirection)
return res["location"]
else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment