Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
EventMachine based HTTP Request interface
C Ruby
Branch: master
Pull request Compare This branch is 598 commits behind igrigorik:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
ext
lib
test
.autotest
LICENSE
README
Rakefile

README

EventMachine based HTTP Request interface. Supports streaming response processing / based on Zed Shaw's Ragel HTTP parser. 
 - Borrows a lot of good concepts from Rev's HttpClient, Curb, and other libraries.
 - Offers support for single or parallel request queries & via deferred callbacks

Simple client example: 
--------

EventMachine.run {
  http = EventMachine::HttpRequest.new('http://127.0.0.1/').get :query => {'keyname' => 'value'}
 
  http.callback {
    p http.response_header.status
    p http.response_header
    p http.response
    
    EventMachine.stop
  }
}

Multi request example:
----------

EventMachine.run {
  multi = EventMachine::MultiRequest.new
      
  # add multiple requests to the multi-handler
  multi.add(EventMachine::HttpRequest.new('http://www.google.com/').get)
  multi.add(EventMachine::HttpRequest.new('http://www.yahoo.com/').get)
      
  multi.callback  {
    p multi.responses[:succeeded]
    p multi.responses[:failed]
       
    EventMachine.stop
  }
}
Something went wrong with that request. Please try again.