X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fwserver.rb;h=b9260170b4997d4d71352145983ce0279cc29b07;hb=6cf365c49ce5fbe24c0a4ff0663550390b501fea;hp=a888ad0c3e9d29a9cd9230366bb3ff600a6d1600;hpb=a7c40c145f5be6c7c99752bb0af93c0735971694;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/wserver.rb b/data/rbot/plugins/wserver.rb index a888ad0c..b9260170 100644 --- a/data/rbot/plugins/wserver.rb +++ b/data/rbot/plugins/wserver.rb @@ -12,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) @@ -34,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)