Class EventMachine::Protocols::HttpClient2
In: lib/em/protocols/httpclient2.rb
Parent: Connection

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

Usage

 EM.run{
   conn = EM::Protocols::HttpClient2.connect 'google.com', 80

   req = conn.get('/')
   req.callback{ |response|
     p(response.status)
     p(response.headers)
     p(response.content)
   }
 }

Methods

Included Modules

LineText2

Classes and Modules

Class EventMachine::Protocols::HttpClient2::Request

Public Class methods

Make a connection to a remote HTTP server. Can take either a pair of arguments (which will be interpreted as a hostname/ip-address and a port), or a hash. If the arguments are a hash, then supported values include:

 :host => a hostname or ip-address
 :port => a port number
 :ssl => true to enable ssl

Public Instance methods

Get a url

 req = conn.get(:uri => '/')
 req.callback{|response| puts response.content }

Post to a url

 req = conn.post('/data')
 req.callback{|response| puts response.content }

@private

[Validate]