def initialize(*args, &block)
host, port, options = DEFAULT_HOST, DEFAULT_PORT, {}
args.each do |arg|
case arg
when 0.class, /^\d+$/ then port = arg.to_i
when String then host = arg
when Hash then options = arg
else
@app = arg if arg.respond_to?(:call)
end
end
self.tag = options[:tag]
@backend = select_backend(host, port, options)
load_cgi_multipart_eof_fix
@backend.server = self
@backend.maximum_connections = DEFAULT_MAXIMUM_CONNECTIONS
@backend.maximum_persistent_connections = DEFAULT_MAXIMUM_PERSISTENT_CONNECTIONS
@backend.timeout = options[:timeout] || DEFAULT_TIMEOUT
@app = Rack::Builder.new(&block).to_app if block
@app = Rack::CommonLogger.new(@app) if Logging.debug?
@setup_signals = options[:signals] != false
end