Class: Explorer::Server::HTTP
- Inherits:
-
Reel::Server::HTTP
- Object
- Reel::Server::HTTP
- Explorer::Server::HTTP
- Defined in:
- lib/explorer/server/http.rb
Instance Method Summary collapse
- #handle_request(request) ⇒ Object
-
#initialize(port, options = {}) ⇒ HTTP
constructor
A new instance of HTTP.
- #on_connection(connection) ⇒ Object
Constructor Details
Instance Method Details
#handle_request(request) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/explorer/server/http.rb', line 18 def handle_request(request) map = @map.resolve(request.headers['Host']) if map Proxy.new(map[:host], map[:port]).handle(request) else request.respond 404, "Map not found (#{request.headers['Host']})" end end |
#on_connection(connection) ⇒ Object
12 13 14 15 16 |
# File 'lib/explorer/server/http.rb', line 12 def on_connection(connection) connection.each_request do |request| handle_request(request) end end |