misc/plugin/recent_rss.rb in tdiary-4.1.3 vs misc/plugin/recent_rss.rb in tdiary-4.2.0

- old
+ new

@@ -74,10 +74,11 @@ class InvalidResourceError < StandardError; end class RSSNotModified < StandardError; end require 'time' +require 'timeout' require 'net/http' require 'uri/generic' require 'rss/parser' require 'rss/1.0' require 'rss/2.0' @@ -148,11 +149,11 @@ rss = nil px_host, px_port = (@conf['proxy'] || '').split( /:/ ) px_port = 80 if px_host and !px_port begin - timeout( 10 ) do + Timeout::timeout( 10 ) do res = Net::HTTP::Proxy( px_host, px_port ).get_response( uri ) case res when Net::HTTPSuccess rss = res.body when Net::HTTPRedirection @@ -162,10 +163,10 @@ raise RSSNotModified else raise InvalidResourceError end end - rescue TimeoutError, SocketError, StandardError + rescue Timeout::Error, SocketError, StandardError raise InvalidResourceError end rss end