2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2003-07-23 12:51:36 -04:00
|
|
|
#
|
|
|
|
# config.rb -- Default configurations.
|
|
|
|
#
|
|
|
|
# Author: IPR -- Internet Programming with Ruby -- writers
|
|
|
|
# Copyright (c) 2000, 2001 TAKAHASHI Masayoshi, GOTOU Yuuzou
|
|
|
|
# Copyright (c) 2003 Internet Programming with Ruby writers. All rights
|
|
|
|
# reserved.
|
|
|
|
#
|
|
|
|
# $IPR: config.rb,v 1.52 2003/07/22 19:20:42 gotoyuzo Exp $
|
|
|
|
|
|
|
|
require 'webrick/version'
|
|
|
|
require 'webrick/httpversion'
|
|
|
|
require 'webrick/httputils'
|
|
|
|
require 'webrick/utils'
|
|
|
|
require 'webrick/log'
|
|
|
|
|
|
|
|
module WEBrick
|
|
|
|
module Config
|
2013-01-25 20:12:54 -05:00
|
|
|
LIBDIR = File::dirname(__FILE__) # :nodoc:
|
2003-07-23 12:51:36 -04:00
|
|
|
|
|
|
|
# for GenericServer
|
|
|
|
General = {
|
|
|
|
:ServerName => Utils::getservername,
|
|
|
|
:BindAddress => nil, # "0.0.0.0" or "::" or nil
|
2009-12-19 03:01:19 -05:00
|
|
|
:Port => nil, # users MUST specify this!!
|
2003-07-23 12:51:36 -04:00
|
|
|
:MaxClients => 100, # maximum number of the concurrent connections
|
|
|
|
:ServerType => nil, # default: WEBrick::SimpleServer
|
|
|
|
:Logger => nil, # default: WEBrick::Log.new
|
|
|
|
:ServerSoftware => "WEBrick/#{WEBrick::VERSION} " +
|
|
|
|
"(Ruby/#{RUBY_VERSION}/#{RUBY_RELEASE_DATE})",
|
|
|
|
:TempDir => ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'/tmp',
|
|
|
|
:DoNotListen => false,
|
|
|
|
:StartCallback => nil,
|
|
|
|
:StopCallback => nil,
|
|
|
|
:AcceptCallback => nil,
|
2016-08-12 08:08:13 -04:00
|
|
|
:DoNotReverseLookup => true,
|
2007-12-18 09:43:03 -05:00
|
|
|
:ShutdownSocketWithoutClose => false,
|
2003-07-23 12:51:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
# for HTTPServer, HTTPRequest, HTTPResponse ...
|
|
|
|
HTTP = General.dup.update(
|
|
|
|
:Port => 80,
|
|
|
|
:RequestTimeout => 30,
|
|
|
|
:HTTPVersion => HTTPVersion.new("1.1"),
|
|
|
|
:AccessLog => nil,
|
|
|
|
:MimeTypes => HTTPUtils::DefaultMimeTypes,
|
|
|
|
:DirectoryIndex => ["index.html","index.htm","index.cgi","index.rhtml"],
|
|
|
|
:DocumentRoot => nil,
|
|
|
|
:DocumentRootOptions => { :FancyIndexing => true },
|
2004-03-07 11:06:43 -05:00
|
|
|
:RequestCallback => nil,
|
|
|
|
:ServerAlias => nil,
|
2006-05-18 09:42:52 -04:00
|
|
|
:InputBufferSize => 65536, # input buffer size in reading request body
|
|
|
|
:OutputBufferSize => 65536, # output buffer size in sending File or IO
|
2003-07-23 12:51:36 -04:00
|
|
|
|
2004-03-07 11:06:43 -05:00
|
|
|
# for HTTPProxyServer
|
2003-07-23 12:51:36 -04:00
|
|
|
:ProxyAuthProc => nil,
|
|
|
|
:ProxyContentHandler => nil,
|
|
|
|
:ProxyVia => true,
|
|
|
|
:ProxyTimeout => true,
|
|
|
|
:ProxyURI => nil,
|
|
|
|
|
|
|
|
:CGIInterpreter => nil,
|
|
|
|
:CGIPathEnv => nil,
|
|
|
|
|
|
|
|
# workaround: if Request-URIs contain 8bit chars,
|
|
|
|
# they should be escaped before calling of URI::parse().
|
|
|
|
:Escape8bitURI => false
|
|
|
|
)
|
|
|
|
|
2013-01-25 20:12:54 -05:00
|
|
|
##
|
|
|
|
# Default configuration for WEBrick::HTTPServlet::FileHandler
|
|
|
|
#
|
|
|
|
# :AcceptableLanguages::
|
|
|
|
# Array of languages allowed for accept-language. There is no default
|
|
|
|
# :DirectoryCallback::
|
|
|
|
# Allows preprocessing of directory requests. There is no default
|
|
|
|
# callback.
|
|
|
|
# :FancyIndexing::
|
|
|
|
# If true, show an index for directories. The default is true.
|
|
|
|
# :FileCallback::
|
|
|
|
# Allows preprocessing of file requests. There is no default callback.
|
|
|
|
# :HandlerCallback::
|
|
|
|
# Allows preprocessing of requests. There is no default callback.
|
|
|
|
# :HandlerTable::
|
|
|
|
# Maps file suffixes to file handlers. DefaultFileHandler is used by
|
|
|
|
# default but any servlet can be used.
|
|
|
|
# :NondisclosureName::
|
|
|
|
# Do not show files matching this array of globs. .ht* and *~ are
|
|
|
|
# excluded by default.
|
|
|
|
# :UserDir::
|
|
|
|
# Directory inside ~user to serve content from for /~user requests.
|
|
|
|
# Only works if mounted on /. Disabled by default.
|
|
|
|
|
2003-07-23 12:51:36 -04:00
|
|
|
FileHandler = {
|
2004-12-15 03:47:49 -05:00
|
|
|
:NondisclosureName => [".ht*", "*~"],
|
2003-07-23 12:51:36 -04:00
|
|
|
:FancyIndexing => false,
|
|
|
|
:HandlerTable => {},
|
|
|
|
:HandlerCallback => nil,
|
|
|
|
:DirectoryCallback => nil,
|
|
|
|
:FileCallback => nil,
|
2005-10-14 03:40:47 -04:00
|
|
|
:UserDir => nil, # e.g. "public_html"
|
2004-10-12 08:26:39 -04:00
|
|
|
:AcceptableLanguages => [] # ["en", "ja", ... ]
|
2003-07-23 12:51:36 -04:00
|
|
|
}
|
|
|
|
|
2013-01-25 20:12:54 -05:00
|
|
|
##
|
|
|
|
# Default configuration for WEBrick::HTTPAuth::BasicAuth
|
|
|
|
#
|
|
|
|
# :AutoReloadUserDB:: Reload the user database provided by :UserDB
|
|
|
|
# automatically?
|
|
|
|
|
2003-07-23 12:51:36 -04:00
|
|
|
BasicAuth = {
|
|
|
|
:AutoReloadUserDB => true,
|
|
|
|
}
|
|
|
|
|
2010-09-11 02:21:51 -04:00
|
|
|
##
|
|
|
|
# Default configuration for WEBrick::HTTPAuth::DigestAuth.
|
|
|
|
#
|
|
|
|
# :Algorithm:: MD5, MD5-sess (default), SHA1, SHA1-sess
|
|
|
|
# :Domain:: An Array of URIs that define the protected space
|
|
|
|
# :Qop:: 'auth' for authentication, 'auth-int' for integrity protection or
|
|
|
|
# both
|
|
|
|
# :UseOpaque:: Should the server send opaque values to the client? This
|
|
|
|
# helps prevent replay attacks.
|
|
|
|
# :CheckNc:: Should the server check the nonce count? This helps the
|
|
|
|
# server detect replay attacks.
|
|
|
|
# :UseAuthenticationInfoHeader:: Should the server send an
|
|
|
|
# AuthenticationInfo header?
|
|
|
|
# :AutoReloadUserDB:: Reload the user database provided by :UserDB
|
|
|
|
# automatically?
|
|
|
|
# :NonceExpirePeriod:: How long should we store used nonces? Default is
|
|
|
|
# 30 minutes.
|
|
|
|
# :NonceExpireDelta:: How long is a nonce valid? Default is 1 minute
|
|
|
|
# :InternetExplorerHack:: Hack which allows Internet Explorer to work.
|
|
|
|
# :OperaHack:: Hack which allows Opera to work.
|
|
|
|
|
2003-07-23 12:51:36 -04:00
|
|
|
DigestAuth = {
|
2009-03-05 22:56:38 -05:00
|
|
|
:Algorithm => 'MD5-sess', # or 'MD5'
|
2003-07-23 12:51:36 -04:00
|
|
|
:Domain => nil, # an array includes domain names.
|
|
|
|
:Qop => [ 'auth' ], # 'auth' or 'auth-int' or both.
|
|
|
|
:UseOpaque => true,
|
|
|
|
:UseNextNonce => false,
|
|
|
|
:CheckNc => false,
|
|
|
|
:UseAuthenticationInfoHeader => true,
|
|
|
|
:AutoReloadUserDB => true,
|
|
|
|
:NonceExpirePeriod => 30*60,
|
|
|
|
:NonceExpireDelta => 60,
|
|
|
|
:InternetExplorerHack => true,
|
|
|
|
:OperaHack => true,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|