]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/wserver.rb
webhook: gitlab support
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / wserver.rb
index fdb4207dfe1d005ba021d04ca8cccc12c4e2facc..b9260170b4997d4d71352145983ce0279cc29b07 100644 (file)
@@ -1,7 +1,3 @@
-require 'net/http'
-require 'uri'
-Net::HTTP.version_1_2
-
 class WserverPlugin < Plugin
   def help(plugin, topic="")
     "wserver <uri> => try and determine what webserver <uri> is using"
@@ -16,20 +12,20 @@ class WserverPlugin < Plugin
         m.reply "cowardly refusing to follow more than 3 redirects"
         return
       end
-      
+
       begin
         uri = URI.parse(hostname)
       rescue URI::InvalidURIError => err
         m.reply "#{hostname} is not a valid URI"
         return
       end
-      
+
       unless(uri)
         m.reply "incorrect usage: " + help(m.plugin)
         return
       end
-        
-      
+
+
       resp = @bot.httputil.head(uri)
       server = resp['Server']
       if(server && server.length > 0)
@@ -38,7 +34,7 @@ class WserverPlugin < Plugin
         m.reply "couldn't tell what #{uri.host} is running"
       end
 
-      if(resp.code == "302" || resp.code == "301") 
+      if(resp.code == "302" || resp.code == "301")
         newloc = resp['location']
         newuri = URI.parse(newloc)
         # detect and ignore incorrect redirects (to relative paths etc)