fork download
  1. require 'webrick'
  2. require "socket"
  3. require "webrick/ssl"
  4.  
  5. #$localip = IPSocket::getaddress(Socket::gethostname)
  6.  
  7. srv = WEBrick::HTTPServer.new( {
  8. :ServerName => "Server", # WEBrick::Utils.getservername
  9. :BindAddress => $localip || "127.0.0.1" ,
  10. :Port => 80,
  11. :MaxClients => 100, # maximum number of the concurrent connections
  12. :ServerType => nil, # default: WEBrick::SimpleServer
  13. :Logger => nil, # default: WEBrick::Log.new
  14. :ServerSoftware => "WEBrick/#{WEBrick::VERSION} " +
  15. "(Ruby/#{RUBY_VERSION}/#{RUBY_RELEASE_DATE})",
  16. :TempDir => ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp',
  17. :DoNotListen => false,
  18. :StartCallback => nil,
  19. :StopCallback => nil,
  20. :AcceptCallback => nil,
  21. :DoNotReverseLookup => nil,
  22.  
  23. :RequestTimeout => 30,
  24. # :HTTPVersion => HTTPVersion.new("1.1"),
  25. :AccessLog => nil,
  26. :MimeTypes => WEBrick::HTTPUtils::DefaultMimeTypes,
  27. :DirectoryIndex => [ "index.cgi" ,"index.html","index.htm","index.rhtml"],
  28. :DocumentRoot => "./",
  29. :DocumentRootOptions => { :FancyIndexing => true },
  30. :RequestCallback => nil,
  31. :ServerAlias => nil,
  32.  
  33. :CGIInterpreter => 'C:\ruby193\bin\ruby.exe',
  34. :CGIPathEnv => nil,
  35.  
  36. # workaround: if Request-URIs contain 8bit chars,
  37. # they should be escaped before calling of URI.parse().
  38. :Escape8bitURI => false
  39.  
  40. # :SSLEnable => true
  41. })
  42.  
  43. # trap('INT') { server.shutdown }
  44.  
  45.  
  46. srv.start
  47.  
  48.  
  49.  
Runtime error #stdin #stdout 0.11s 7692KB
stdin
Standard input is empty
stdout
Standard output is empty