123456789_123456789_123456789_123456789_123456789_

Module: WEBrick::Config

Relationships & Source Files
Defined in: lib/webrick/ssl.rb,
lib/webrick/config.rb,
lib/webrick/https.rb

Constant Summary

  • BasicAuth =

    Default configuration for HTTPAuth::BasicAuth

    :AutoReloadUserDB

    Reload the user database provided by :UserDB automatically?

    # File 'lib/webrick/config.rb', line 118
    {
      :AutoReloadUserDB     => true,
    }
  • DigestAuth =

    Default configuration for 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.

    # File 'lib/webrick/config.rb', line 143
    {
      :Algorithm            => 'MD5-sess', # or 'MD5'
      :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,
    }
  • FileHandler =

    Default configuration for 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.

    # File 'lib/webrick/config.rb', line 101
    {
      :NondisclosureName => [".ht*", "*~"],
      :FancyIndexing     => false,
      :HandlerTable      => {},
      :HandlerCallback   => nil,
      :DirectoryCallback => nil,
      :FileCallback      => nil,
      :UserDir           => nil,  # e.g. "public_html"
      :AcceptableLanguages => []  # ["en", "ja", ... ]
    }
  • General = # File 'lib/webrick/config.rb', line 23
    Hash.new { |hash, key|
      case key
      when :ServerName
        hash[key] = Utils.getservername
      else
        nil
      end
    }.update(
      :BindAddress    => nil,   # "0.0.0.0" or "::" or nil
      :Port           => nil,   # users MUST specify this!!
      :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,
      :DoNotReverseLookup => true,
      :ShutdownSocketWithoutClose => false,
    )
  • HTTP = # File 'lib/webrick/config.rb', line 48
    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 },
      :RequestCallback => nil,
      :ServerAlias    => nil,
      :InputBufferSize  => 65536, # input buffer size in reading request body
      :OutputBufferSize => 65536, # output buffer size in sending File or IO
    
      # for HTTPProxyServer
      :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
    )
  • LIBDIR = Internal use only
    # File 'lib/webrick/config.rb', line 20
    File::dirname(__FILE__)
  • SSL =

    Default SSL server configuration.

    ::WEBrick can automatically create a self-signed certificate if :SSLCertName is set. For more information on the various SSL options see OpenSSL::SSL::SSLContext.

    :ServerSoftware

    The server software name used in the Server: header.

    :SSLEnable

    false,

    Enable SSL for this server.  Defaults to false.
    :SSLCertificate

    The SSL certificate for the server.

    :SSLPrivateKey

    The SSL private key for the server certificate.

    :SSLClientCA

    nil,

    Array of certificates that will be sent to the client.
    :SSLExtraChainCert

    nil,

    Array of certificates that will be added to the certificate chain
    :SSLCACertificateFile

    nil,

    Path to a CA certificate file
    :SSLCACertificatePath

    nil,

    Path to a directory containing CA certificates
    :SSLCertificateStore

    nil,

    OpenSSL::X509::Store used for certificate validation of the client
    :SSLTmpDhCallback

    nil,

    Callback invoked when DH parameters are required.
    :SSLVerifyClient

    Sets whether the client is verified. This defaults to VERIFY_NONE which is typical for an HTTPS server.

    :SSLVerifyDepth

    Number of CA certificates to walk when verifying a certificate chain

    :SSLVerifyCallback

    Custom certificate verification callback

    :SSLServerNameCallback

    Custom servername indication callback

    :SSLTimeout

    Maximum session lifetime

    :SSLOptions

    Various SSL options

    :SSLCiphers

    Ciphers to be used

    :SSLStartImmediately

    Immediately start SSL upon connection? Defaults to true

    :SSLCertName

    SSL certificate name. Must be set to enable automatic certificate creation.

    :SSLCertComment

    Comment used during automatic certificate creation.

    # File 'lib/webrick/ssl.rb', line 67
    {
      :ServerSoftware       => "#{svrsoft} OpenSSL/#{osslv}",
      :SSLEnable            => false,
      :SSLCertificate       => nil,
      :SSLPrivateKey        => nil,
      :SSLClientCA          => nil,
      :SSLExtraChainCert    => nil,
      :SSLCACertificateFile => nil,
      :SSLCACertificatePath => nil,
      :SSLCertificateStore  => nil,
      :SSLTmpDhCallback     => nil,
      :SSLVerifyClient      => ::OpenSSL::SSL::VERIFY_NONE,
      :SSLVerifyDepth       => nil,
      :SSLVerifyCallback    => nil,   # custom verification
      :SSLTimeout           => nil,
      :SSLOptions           => nil,
      :SSLCiphers           => nil,
      :SSLStartImmediately  => true,
      # Must specify if you use auto generated certificate.
      :SSLCertName          => nil,
      :SSLCertComment       => "Generated by Ruby/OpenSSL"
    }