diff --git a/cgi-bin/malp.rb b/cgi-bin/malp.rb index 605bd09..91ed0d6 100755 --- a/cgi-bin/malp.rb +++ b/cgi-bin/malp.rb @@ -85,10 +85,17 @@ if cgi.params.key?("content") if authenticated html = "" - sock = UNIXSocket.new("/run/malpd/malpd.sock") - sock.puts "info" - info = JSON.parse(sock.gets) - sock.close + begin + sock = UNIXSocket.new("/run/malpd/malpd.sock") + sock.puts "info" + info = JSON.parse(sock.gets) + sock.close + rescue + cgi.out("type" => "text/html", "charset" => "UTF-8") do + "Could not connect to malpd socket" + end + exit + end info.each do |entry| case entry["type"]