From b4a2acb36685b6aeb4e257036cb32175a9aa8b0e Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 12 Feb 2008 21:46:21 +0100 Subject: httputil: config values for HTTP read and open timeouts --- lib/rbot/core/utils/httputil.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb index 3f297345..2c83cebb 100644 --- a/lib/rbot/core/utils/httputil.rb +++ b/lib/rbot/core/utils/httputil.rb @@ -149,6 +149,10 @@ module Utils # this class can check the bot proxy configuration to determine if a proxy # needs to be used, which includes support for per-url proxy configuration. class HttpUtil + Bot::Config.register Bot::Config::IntegerValue.new('http.read_timeout', + :default => 10, :desc => "Default read timeout for HTTP connections") + Bot::Config.register Bot::Config::IntegerValue.new('http.open_timeout', + :default => 20, :desc => "Default open timeout for HTTP connections") Bot::Config.register Bot::Config::BooleanValue.new('http.use_proxy', :default => false, :desc => "should a proxy be used for HTTP requests?") Bot::Config.register Bot::Config::StringValue.new('http.proxy_uri', :default => false, @@ -345,8 +349,8 @@ class HttpUtil # def get_proxy(uri, options = {}) opts = { - :read_timeout => 10, - :open_timeout => 20 + :read_timeout => @bot.config["http.read_timeout"], + :open_timeout => @bot.config["http.open_timeout"] }.merge(options) proxy = nil -- cgit v1.2.3