diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-24 13:44:05 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-24 13:44:05 +0000 |
commit | 8dc50e291870522ffbf1d9eafb6f9d1f72f03e83 (patch) | |
tree | 7938ab3e628873de85249d916670c4a597665218 | |
parent | b4f935f5439188fb715951a51f7179e637022f2c (diff) |
Additiona work on the caching we really have to look into some serious http library with automatic cache management
-rw-r--r-- | lib/rbot/httputil.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rbot/httputil.rb b/lib/rbot/httputil.rb index 1a43c185..92918f77 100644 --- a/lib/rbot/httputil.rb +++ b/lib/rbot/httputil.rb @@ -133,6 +133,7 @@ class HttpUtil # simple get request, returns (if possible) response body following redirs # and caching if requested # if a block is given, it yields the urls it gets redirected to + # TODO we really need something to implement proper caching def get(uri_or_str, readtimeout=10, opentimeout=5, max_redir=@bot.config["http.max_redir"], cache=false) if uri_or_str.class <= URI uri = uri_or_str @@ -150,7 +151,7 @@ class HttpUtil resp = http.get(uri.request_uri(), @headers) case resp when Net::HTTPSuccess - if cache + if cache && !(resp.key?('cache-control') && resp['cache-control']=='must-revalidate') k = uri.to_s @cache[k] = Hash.new @cache[k][:body] = resp.body |