// Simple ruby webrick server
require 'webrick'
access_log_stream = File.open('C:\\Documents and Settings\\madann\\My Documents\\access.log', 'w')
access_log = [ [ access_log_stream, WEBrick::AccessLog::COMBINED_LOG_FORMAT ] ]
DocumentRoot = 'C:\\Documents and Settings\\madann\\My Documents\\Public_html\\';
HTTPPort = 8008
begin
d = Dir.open(DocumentRoot)
rescue
puts "Creating Documentroot"
mkdir DocumentRoot
end
class DownloadHandler < WEBrick::HTTPServlet::AbstractServlet
def do_get(req,resp)
p "req : ",req
p "resp : ",resp
end
def go_post(req,resp)
resp
end
end
s = WEBrick::HTTPServer.new(
:Port => HTTPPort,
:DocumentRoot => DocumentRoot,
:FancyIndexing => true
)
s.mount("/cgi-bin",
WEBrick::HTTPServlet::FileHandler,
"C:\\Documents and Settings\\madann\\My Documents\\Public_html\\cgi-bin\\",
{:FancyIndexing=>true})
trap("INT"){ s.shutdown }
s.start