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

Usage

 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

Arg list

:host => ‘ip/dns’, :port => fixnum, :verb => ‘GET’, :request => ‘path’, :basic_auth => {:username => ’’, :password => ’’}, :content => ‘content’, :contenttype => ‘text/plain’, :query_string => ’’, :host_header => ’’, :cookie => ’’

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]