# -O option to arirang ruby script
# by pilot
class Arirang

#@ari_port = 80
#@ari_recvsize = 1024
#@ari_recvflag = 3

    def baedal
        ari_title  = "http server allow check\n"
        ari_desc   = "-O option to arirang ruby script\n"
        ari_author = "pilot <pilot@monkey.org>\n"

        puts "title: #{ari_title}"
        puts "desc: #{ari_desc}"
        puts "author: #{ari_author}"
    end

    def asadal
        ariconnect
        buf = "OPTIONS / HTTP/1.0\r\n\r\n"
        resp = arisend(buf)

        # buf = $ari_recv.split("\r\n")[0..10].join("\r\n")
        resp.each_line do |line|
        x = line.match(/^Allow\: (.+)/)
            if x != nil
                y = "#{$ari_host} - #{$ari_sport}/tcp - #{x[1]}\n"
                ariprint(y)
            end

        end

    end

end

