An evented http server built on top of eventmachine
Ruby C++
Latest commit 8a23210 Jun 9, 2015 @raggi raggi Merge pull request #31 from abonec/patch-1
Update eventmachine_httpserver.gemspec
Failed to load latest commit information.
docs Import with fixes, rake cleanup, and working test suite Dec 19, 2008
lib Fix wrong Content-Length with non ASCII-8BIT strings (closes #12) Nov 24, 2012
test Send full HTTP/1.1 headers. Capitalize headers per HTTP/1.1 spec Jun 25, 2011
.gitignore Import with fixes, rake cleanup, and working test suite Dec 19, 2008 Better Readme Oct 18, 2012
Rakefile Rakefile warning cleanups Aug 7, 2011
eventmachine_httpserver.gemspec Update eventmachine_httpserver.gemspec Jun 8, 2015
eventmachine_httpserver.gemspec.tmpl Make gem buildable with recent rubygems Aug 7, 2011


EM::HttpServer vs Thin

 +careo | is there a 25 word version of how it differs from thin?
  +tmm1 | good question.. its probably faster, but only because it doesn't have a real http parser like thin
+wyhaines | It is faster.  It's more of an nginx style parser than the mongrel, grammar based parser.
 +careo | so perhaps a better fit for putting an http interface on top of a bunch of already-evented code?
+wyhaines | careo: It depends.  There are very valid arguments for using an RFC-compliant parser a lot of the time.
+wyhaines | But, yeah, sometimes being strictly RFC compliant isn't something that you care about.


Without Bundler

sudo gem install eventmachine_httpserver

With bundler

gem 'eventmachine_httpserver', :require => 'evma_httpserver'

Usage example

require 'eventmachine'
require 'evma_httpserver'

class MyHttpServer < EM::Connection
  include EM::HttpServer

   def post_init

  def process_http_request
    # the http request details are available via the following instance variables:
    #   @http_protocol
    #   @http_request_method
    #   @http_cookie
    #   @http_if_none_match
    #   @http_content_type
    #   @http_path_info
    #   @http_request_uri
    #   @http_query_string
    #   @http_post_content
    #   @http_headers

    response =
    response.status = 200
    response.content_type 'text/html'
    response.content = '<center><h1>Hi there</h1></center>'
  EM.start_server '', 8080, MyHttpServer