summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/url.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb
index 08fb1f40..f13398a8 100644
--- a/data/rbot/plugins/url.rb
+++ b/data/rbot/plugins/url.rb
@@ -38,8 +38,9 @@ class UrlPlugin < Plugin
url = URI.parse(uri_str)
return if url.scheme !~ /https?/
- puts "+ connecting to #{url.host}:#{url.port}"
- title = Net::HTTP.start(url.host, url.port) do |http|
+ puts "+ connecting to #{url.host}:#{url.port}"
+ http = @bot.httputil.get_proxy(url)
+ title = http.start do |http|
url.path = '/' if url.path == ''
head = http.request_head(url.path)
case head
@@ -70,9 +71,9 @@ class UrlPlugin < Plugin
return "[Link Info] type: #{head['content-type']}#{size ? ", size: #{size} bytes" : ""}"
end
when Net::HTTPClientError then
- return "Error getting link (#{response.code} - #{response.message})"
+ return "[Link Info] Error getting link (#{head.code} - #{head.message})"
when Net::HTTPServerError then
- return "Error getting link (#{response.code} - #{response.message})"
+ return "[Link Info] Error getting link (#{head.code} - #{head.message})"
end
end
rescue SocketError => e