# arirang ruby script example
# export PROXY_TYPE="RELAY"
# required the -X option
# eg) arirang -X yourproxy:3128 -R server11_relay.rb -h yourhost/24
class Arirang

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

     def baedal
        $ari_info = {
        'description' => '-G option + HTTP/1.1 to arirang ruby script',
        'author' => 'pilot pilot@monkey.org'
        }
        puts $ari_info['description'] + "\n\n" 
     end

     def asadal
         ariconnect
         buf  = "GET http://#{$ari_host}/ HTTP/1.1\r\n"
         buf += "Host: #{$ari_host}\r\n\r\n"
         response = arisend(buf)
         response.each do |line|
         x = line.match(/^Server\: (.+)\r/)
            if x != nil
                y = "#{$ari_host} - #{x[1]}\n"
                ariprint(y)
            end
         end
     end

end