summaryrefslogtreecommitdiff
path: root/data/rbot/plugins/url.rb
diff options
context:
space:
mode:
authorDmitry Kim <dmitry point kim at gmail point com>2007-04-05 13:31:44 +0000
committerDmitry Kim <dmitry point kim at gmail point com>2007-04-05 13:31:44 +0000
commit0a52926eb8d349fb04041bb74073d0e7e3c21693 (patch)
treedbca86a051c0cfd0476476d1e768e4e74952dc64 /data/rbot/plugins/url.rb
parent5a2e304a232c153d03e600399baadee3ca47e57f (diff)
* (url) fix response size reporting for ranged responses
Diffstat (limited to 'data/rbot/plugins/url.rb')
-rw-r--r--data/rbot/plugins/url.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb
index f3eb3a7f..978bea6b 100644
--- a/data/rbot/plugins/url.rb
+++ b/data/rbot/plugins/url.rb
@@ -76,6 +76,11 @@ class UrlPlugin < Plugin
unless @bot.config['url.titles_only']
# content doesn't have title, just display info.
size = response['content-length'].gsub(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2') rescue nil
+ if response.code == '206'
+ if response['content-range'] =~ /bytes\s*[^\/]+\/(\d+)/
+ size = $1
+ end
+ end
size = size ? ", size: #{size} bytes" : ""
return "type: #{response['content-type']}#{size}#{extra}"
end