diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-12 21:46:21 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-12 21:46:21 +0100 |
commit | b4a2acb36685b6aeb4e257036cb32175a9aa8b0e (patch) | |
tree | 95c3f40410a884cbbf429efd1fbe1adbe2307ce6 /lib/rbot | |
parent | 20badc14bb65e3f6d70ff7ecc6b4494e8bfbd12a (diff) |
httputil: config values for HTTP read and open timeouts
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/utils/httputil.rb | 8 |
1 files changed, 6 insertions, 2 deletions
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 |