]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
httputil: config values for HTTP read and open timeouts
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 12 Feb 2008 20:46:21 +0000 (21:46 +0100)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 12 Feb 2008 20:46:21 +0000 (21:46 +0100)
lib/rbot/core/utils/httputil.rb

index 3f297345ebfa96bfd35b5f773d8fa3a41e790a83..2c83cebb4f80a017bdae007a8cb6edb11bf174b5 100644 (file)
@@ -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