diff options
author | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-21 11:39:57 +0000 |
---|---|---|
committer | Tom Gilbert <tom@linuxbrit.co.uk> | 2005-07-21 11:39:57 +0000 |
commit | bd3621d2e107924e4620a981b34bd351c4a7e8e1 (patch) | |
tree | 7256837db47a7eacbd6da5a72832e48f297ba5dc | |
parent | ca4b8b57bd382ca4619cac1157f14ea0e396cc55 (diff) |
fix up the new http util to work properly with GET's
-rw-r--r-- | rbot/httputil.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rbot/httputil.rb b/rbot/httputil.rb index 000dcf98..ff3216a6 100644 --- a/rbot/httputil.rb +++ b/rbot/httputil.rb @@ -9,6 +9,9 @@ Net::HTTP.version_1_2 class HttpUtil def initialize(bot) @bot = bot + @headers = { + 'User-Agent' => "rbot http util #{$version} (http://linuxbrit.co.uk/rbot/)", + } end # uri:: Uri to create a proxy for @@ -67,9 +70,11 @@ class HttpUtil begin proxy.start() {|http| - resp = http.get(uri) + resp = http.get(uri.request_uri(), @headers) if resp.code == "200" return resp.body + else + puts "HttpUtil.get return code #{resp.code} #{resp.body}" end return nil } |