2003-09-24 11:18:44 -04:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'webrick'
|
2004-02-15 06:50:02 -05:00
|
|
|
require 'soap/property'
|
2003-09-24 11:18:44 -04:00
|
|
|
|
2004-02-15 06:50:02 -05:00
|
|
|
docroot = "."
|
|
|
|
port = 8808
|
|
|
|
if opt = SOAP::Property.loadproperty("samplehttpd.conf")
|
|
|
|
docroot = opt["docroot"]
|
|
|
|
port = Integer(opt["port"])
|
|
|
|
end
|
2003-09-24 11:18:44 -04:00
|
|
|
|
|
|
|
s = WEBrick::HTTPServer.new(
|
|
|
|
:BindAddress => "0.0.0.0",
|
2004-02-15 06:50:02 -05:00
|
|
|
:Port => port,
|
|
|
|
:DocumentRoot => docroot,
|
2003-09-24 11:18:44 -04:00
|
|
|
:CGIPathEnv => ENV['PATH']
|
|
|
|
)
|
|
|
|
trap(:INT){ s.shutdown }
|
|
|
|
s.start
|