X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=lib%2Frbot%2Fhttputil.rb;h=b4f25c95e77aa6de7ac5e4689d7f11c9e4a928f8;hb=42fd60e6a81e592553cdc6bb3b6011386692dde2;hp=b49a42b1293fd46d4badf2e1b7e9f2fca24aae22;hpb=d30940cb5ff75cf7eab81f6a588b3b5297a762ad;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/lib/rbot/httputil.rb b/lib/rbot/httputil.rb index b49a42b1..b4f25c95 100644 --- a/lib/rbot/httputil.rb +++ b/lib/rbot/httputil.rb @@ -1,4 +1,5 @@ module Irc +module Utils require 'resolv' require 'net/http' @@ -22,6 +23,7 @@ class HttpUtil :default => [], :desc => "List of regexps to check against a URI's hostname/ip to see if we should use the proxy to access this URI. All URIs are proxied by default if the proxy is set, so this is only required to re-include URIs that might have been excluded by the exclude list. e.g. exclude /.*\.foo\.com/, include bar\.foo\.com") BotConfig.register BotConfigArrayValue.new('http.proxy_exclude', + :default => [], :desc => "List of regexps to check against a URI's hostname/ip to see if we should use avoid the proxy to access this URI and access it directly") def initialize(bot) @@ -43,7 +45,7 @@ class HttpUtil list = [uri.host] begin - list.push Resolv.getaddresses(uri.host) + list.concat Resolv.getaddresses(uri.host) rescue StandardError => err puts "warning: couldn't resolve host uri.host" end @@ -89,10 +91,10 @@ class HttpUtil if @bot.config["http.use_proxy"] if (ENV['http_proxy']) - proxy = URI.parse ENV['http_proxy'] + proxy = URI.parse ENV['http_proxy'] rescue nil end if (@bot.config["http.proxy_uri"]) - proxy = URI.parse ENV['http_proxy_uri'] + proxy = URI.parse @bot.config["http.proxy_uri"] rescue nil end if proxy debug "proxy is set to #{proxy.uri}" @@ -135,5 +137,5 @@ class HttpUtil return nil end end - +end end