summaryrefslogtreecommitdiff
path: root/lib/rbot/core
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-03-25 00:22:00 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-03-25 00:22:00 +0000
commitb4d55669782d34c59688e7413402ab489bb0791e (patch)
tree47217c55a5778a088212a265b785220cb157ad94 /lib/rbot/core
parent0423812d31e5c533468a7d4c284932bfec6fcceb (diff)
url plugin: customizable max amount of data to retrieve to look for a title. return standard header info if no title found
Diffstat (limited to 'lib/rbot/core')
-rw-r--r--lib/rbot/core/utils/httputil.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb
index 6ca12d5b..904e1941 100644
--- a/lib/rbot/core/utils/httputil.rb
+++ b/lib/rbot/core/utils/httputil.rb
@@ -23,14 +23,14 @@ module ::Net
class HTTPResponse
# Read chunks from the body until we have at least _size_ bytes, yielding
# the partial text at each chunk. Return the partial body.
- def partial_body(size, &block)
+ def partial_body(size=0, &block)
partial = String.new
self.read_body { |chunk|
partial << chunk
yield partial
- break if size and partial.length >= size
+ break if size and size > 0 and partial.length >= size
}
return partial
@@ -75,6 +75,9 @@ class HttpUtil
BotConfig.register BotConfigIntegerValue.new('http.no_expire_cache',
:default => false,
:desc => "Set this to true if you want the bot to never expire the cached pages")
+ BotConfig.register BotConfigIntegerValue.new('http.info_bytes',
+ :default => 4096,
+ :desc => "How many bytes to download from a web page to find some information. Set to 0 to let the bot download the whole page.")
def initialize(bot)
@bot = bot