Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Mongrel2 Connection Adapter - Ruby Encrusted Steel-Reinforced Fist

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 benchmarks
Octocat-spinner-32 example
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 ISSUES
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 m2r.gemspec


A mongrel2 backend handler written in Ruby, based on Zed's Python backend handler.


  • examples/http_0mq.rb is a test little servlet thing (based on what comes with mongrel2).
  • examples/rack_handler.rb is a Mongrel2 ruby handler rack handler mouthful, whose variables are probably a little off.
  • examples/ is a rackup file using the Rack handler that'll serve Rack's funny little lobster app.

Running Examples

  • ruby examples/http_0mq.rb, which with Mongrel2's test config will serve up at http://localhost:6767/handlertest
  • rackup examples/, ditto, http://localhost:6767/handlertest

With rails3: Add this to your Gemfile:

gem 'ffi'
gem 'ffi-rzmq'
gem 'json'

And this to your

$: << location_to_m2r + '/example'
require 'rack_handler' YourRailsAppName::Application

Then do all like bundle exec rackup


  • JRuby 1.5+ (don't use MRI - it will crash horribly, check the ISSUES file)
  • FFI, gem install ffi should be fine.
  • Zero MQ, you'll need to compile and install to get the headers and such for:
  • ffi-rzmq, which you'll have to build. The native zmq didn't work for me, but if you want to fix it, please do!
  • json, since the headers are returned in JSON, which is RAD. (Really Awesome, Dude)
  • Rack gem install rack if you want to run the rack example.


Once you've made your great commits:

  1. Fork m2r
  2. Create a topic branch - git checkout -b my_branch
  3. Push to your branch - git push origin my_branch
  4. Send a pull request
Something went wrong with that request. Please try again.