Class: HTTPI::Adapter::EmHttpRequest

Inherits:
Base
  • Object
show all
Defined in:
lib/httpi/adapter/em_http.rb

Overview

An HTTPI adapter for ‘EventMachine::HttpRequest`. Due to limitations of the em-httprequest library, not all features are supported. In particular,

  • CA files,

  • certificate verification modes other than “none” and “peer,”

  • NTLM authentication,

  • digest authentication, and

  • password-protected certificate keys

are supported by HTTPI but not em-httprequest.

In addition, some features of em-httprequest are not represented in HTTPI and are therefore not supported. In particular,

  • SOCKS5 proxying,

  • automatic redirect following,

  • response streaming,

  • file body streaming,

  • keepalive,

  • pipelining, and

  • multi-request

are supported by em-httprequest but not HTTPI.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

register

Constructor Details

#initialize(request) ⇒ EmHttpRequest

Returns a new instance of EmHttpRequest.



34
35
36
37
# File 'lib/httpi/adapter/em_http.rb', line 34

def initialize(request)
  @request = request
  @client = EventMachine::HttpRequest.new build_request_url(request.url), connection_options
end

Instance Attribute Details

#cert_directoryObject



41
42
43
# File 'lib/httpi/adapter/em_http.rb', line 41

def cert_directory
  @cert_directory ||= "/tmp"
end

#clientObject (readonly)

Returns the value of attribute client.



39
40
41
# File 'lib/httpi/adapter/em_http.rb', line 39

def client
  @client
end

Instance Method Details

#request(method) ⇒ Object

Executes arbitrary HTTP requests.

See Also:



49
50
51
# File 'lib/httpi/adapter/em_http.rb', line 49

def request(method)
  _request { |options| @client.send method, options }
end