Class EventMachine::Protocols::HttpClient
In: lib/em/protocols/httpclient.rb
Parent: Connection

Note: This class is deprecated and will be removed. Please use EM-HTTP-Request instead.

@example

 EventMachine.run {
   http = EventMachine::Protocols::HttpClient.request(
     :host => server,
     :port => 80,
     :request => "/index.html",
     :query_string => "parm1=value1&parm2=value2"
   )
   http.callback {|response|
     puts response[:status]
     puts response[:headers]
     puts response[:content]
   }
 }

Methods

Included Modules

EventMachine::Deferrable

Constants

MaxPostContentLength = 20 * 1024 * 1024

Public Class methods

@param args [Hash] The request arguments @option args [String] :host The host IP/DNS name @option args [Integer] :port The port to connect too @option args [String] :verb The request type [GET | POST | DELETE | PUT] @option args [String] :request The request path @option args [Hash] :basic_auth The basic auth credentials (:username and :password) @option args [String] :content The request content @option args [String] :contenttype The content type (e.g. text/plain) @option args [String] :query_string The query string @option args [String] :host_header The host header to set @option args [String] :cookie Cookies to set

Public Instance methods

We send the request when we get a connection. AND, we set an instance variable to indicate we passed through here. That allows unbind to know whether there was a successful connection. NB: This naive technique won‘t work when we have to support multiple requests on a single connection.

[Validate]