diff options
-rw-r--r-- | lib/rbot/httputil.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/rbot/httputil.rb b/lib/rbot/httputil.rb index e80a45aa..18fc6a55 100644 --- a/lib/rbot/httputil.rb +++ b/lib/rbot/httputil.rb @@ -152,7 +152,11 @@ class HttpUtil begin proxy.start() {|http| yield uri.request_uri() if block_given? - resp = http.get(uri.request_uri(), @headers) + req = Net::HTTP::Get.new(uri.request_uri(), @headers) + if uri.user and uri.password + req.basic_auth(uri.user, uri.password) + end + resp = http.request(req) case resp when Net::HTTPSuccess if cache && !(resp.key?('cache-control') && resp['cache-control']=='must-revalidate') @@ -208,7 +212,11 @@ class HttpUtil begin proxy.start() {|http| yield uri.request_uri() if block_given? - resp = http.request_head(uri.request_uri(), @headers) + req = Net::HTTP::Head.new(uri.request_uri(), @headers) + if uri.user and uri.password + req.basic_auth(uri.user, uri.password) + end + resp = http.request(req) case resp when Net::HTTPSuccess return resp |