From 0a52926eb8d349fb04041bb74073d0e7e3c21693 Mon Sep 17 00:00:00 2001 From: Dmitry Kim Date: Thu, 5 Apr 2007 13:31:44 +0000 Subject: * (url) fix response size reporting for ranged responses --- data/rbot/plugins/url.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'data/rbot/plugins') 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 -- cgit v1.2.3