1 # 2 # config.rb -- Default configurations. 3 # 4 # Author: IPR -- Internet Programming with Ruby -- writers 5 # Copyright (c) 2000, 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou 6 # Copyright (c) 2003 Internet Programming with Ruby writers. All rights 7 # reserved. 8 # 9 # $IPR: config.rb,v 1.52 2003/07/22 19:20:42 gotoyuzo Exp $ 10 11 require 'webrick/version' 12 require 'webrick/httpversion' 13 require 'webrick/httputils' 14 require 'webrick/utils' 15 require 'webrick/log' 16 17 module WEBrick 18 module Config 19 LIBDIR = File::dirname(__FILE__) 20 21 # for GenericServer 22 General = { 23 :ServerName => Utils::getservername, 24 :BindAddress => nil, # "0.0.0.0" or "::" or nil 25 :Port => nil, # users MUST specifiy this!! 26 :MaxClients => 100, # maximum number of the concurrent connections 27 :ServerType => nil, # default: WEBrick::SimpleServer 28 :Logger => nil, # default: WEBrick::Log.new 29 :ServerSoftware => "WEBrick/#{WEBrick::VERSION} " + 30 "(Ruby/#{RUBY_VERSION}/#{RUBY_RELEASE_DATE})", 31 :TempDir => ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp', 32 :DoNotListen => false, 33 :StartCallback => nil, 34 :StopCallback => nil, 35 :AcceptCallback => nil, 36 } 37 38 # for HTTPServer, HTTPRequest, HTTPResponse ... 39 HTTP = General.dup.update( 40 :Port => 80, 41 :RequestTimeout => 30, 42 :HTTPVersion => HTTPVersion.new("1.1"), 43 :AccessLog => nil, 44 :MimeTypes => HTTPUtils::DefaultMimeTypes, 45 :DirectoryIndex => ["index.html","index.htm","index.cgi","index.rhtml"], 46 :DocumentRoot => nil, 47 :DocumentRootOptions => { :FancyIndexing => true }, 48 :RequestHandler => nil, 49 :RequestCallback => nil, # alias of :RequestHandler 50 :ServerAlias => nil, 51 52 # for HTTPProxyServer 53 :ProxyAuthProc => nil, 54 :ProxyContentHandler => nil, 55 :ProxyVia => true, 56 :ProxyTimeout => true, 57 :ProxyURI => nil, 58 59 :CGIInterpreter => nil, 60 :CGIPathEnv => nil, 61 62 # workaround: if Request-URIs contain 8bit chars, 63 # they should be escaped before calling of URI::parse(). 64 :Escape8bitURI => false 65 ) 66 67 FileHandler = { 68 :NondisclosureName => [".ht*", "*~"], 69 :FancyIndexing => false, 70 :HandlerTable => {}, 71 :HandlerCallback => nil, 72 :DirectoryCallback => nil, 73 :FileCallback => nil, 74 :UserDir => nil, # e.g. "public_html" 75 :AcceptableLanguages => [] # ["en", "ja", ... ] 76 } 77 78 BasicAuth = { 79 :AutoReloadUserDB => true, 80 } 81 82 DigestAuth = { 83 :Algorithm => 'MD5-sess', # or 'MD5' 84 :Domain => nil, # an array includes domain names. 85 :Qop => [ 'auth' ], # 'auth' or 'auth-int' or both. 86 :UseOpaque => true, 87 :UseNextNonce => false, 88 :CheckNc => false, 89 :UseAuthenticationInfoHeader => true, 90 :AutoReloadUserDB => true, 91 :NonceExpirePeriod => 30*60, 92 :NonceExpireDelta => 60, 93 :InternetExplorerHack => true, 94 :OperaHack => true, 95 } 96 end 97 end