Class: Spider::HTTP::Thin

Inherits:
Server show all
Defined in:
lib/spiderfw/http/adapters/thin.rb

Instance Method Summary collapse

Methods inherited from Server

get_opts, #request_received, #shutdown, #start, start, supports?

Instance Method Details

#options(opts) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/spiderfw/http/adapters/thin.rb', line 12

def options(opts)
    opts = super(opts)
    defaults = {
        :Host   => '0.0.0.0',
        :app    => 'spider'
    }
    return defaults.merge(opts)
end

#shutdown_serverObject



34
35
36
# File 'lib/spiderfw/http/adapters/thin.rb', line 34

def shutdown_server
    @server.stop
end

#start_server(opts = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/spiderfw/http/adapters/thin.rb', line 22

def start_server(opts={})
    opts = options(opts)
    options = {
        :Port           => opts[:Port],
        :BindAddress    => opts[:Host]
    }
    @server = ::Thin::Server.start(opts[:Host], opts[:Port].to_i, Spider::HTTP::RackApplication.new) do 
        use Rack::CommonLogger
        use Rack::ShowExceptions
    end
end