Class: WebFetch::Server

Inherits:
EM::Connection
  • Object
show all
Includes:
EM::HttpServer, HTTPHelpers
Defined in:
lib/web_fetch/server.rb

Overview

Web server that accepts requests to gather and retrieve external HTTP requests

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HTTPHelpers

#accept_gzip?, #compress, #default_headers, #fail_, #pending, #post_data, #request_params, #respond_immediately, #succeed

Instance Attribute Details

#storageObject (readonly)

Returns the value of attribute storage.



7
8
9
# File 'lib/web_fetch/server.rb', line 7

def storage
  @storage
end

Instance Method Details

#post_initObject



12
13
14
15
16
17
18
# File 'lib/web_fetch/server.rb', line 12

def post_init
  super
  @router = Router.new
  @storage = WebFetch::Storage.create

  no_environment_strings
end

#process_http_requestObject



20
21
22
23
24
25
26
# File 'lib/web_fetch/server.rb', line 20

def process_http_request
  resource = @router.route(@http_request_uri, request_params)
  response = EM::DelegatedHttpResponse.new(self)
  default_headers(response)

  outcome(resource, response)
end