Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Contributed Rack Middleware and Utilities

tree: b47276575a

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 COPYING
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 rack-contrib.gemspec
README.rdoc

Contributed Rack Middleware and Utilities

This package includes a variety of add-on components for Rack, a Ruby web server interface:

  • Rack::ETag - Automatically sets the ETag header on all String bodies.

  • Rack::JSONP - Adds JSON-P support by stripping out the callback param and padding the response with the appropriate callback format.

  • Rack::LighttpdScriptNameFix - Fixes how lighttpd sets the SCRIPT_NAME and PATH_INFO variables in certain configurations.

  • Rack::Locale - Detects the client locale using the Accept-Language request header and sets a rack.locale variable in the environment.

  • Rack::MailExceptions - Rescues exceptions raised from the app and sends a useful email with the exception, stacktrace, and contents of the environment.

  • Rack::PostBodyContentTypeParser - Adds support for JSON request bodies. The Rack parameter hash is populated by deserializing the JSON data provided in the request body when the Content-Type is application/json.

  • Rack::ProcTitle - Displays request information in process title ($0) for monitoring/inspection with ps(1).

  • Rack::Profiler - Uses ruby-prof to measure request time.

  • Rack::Sendfile - Enables X-Sendfile support for bodies that can be served from file.

  • Rack::TimeZone - Detects the clients timezone using JavaScript and sets a variable in Rack's environment with the offset from UTC.

Use

Git is the quickest way to the rack-contrib sources:

git clone git://github.com/rack/rack-contrib.git

Gems are currently available from GitHub clones:

gem install rack-rack-contrib --source=http://gems.github.com/

Requiring 'rack/contrib' will add autoloads to the Rack modules for all of the components included. The following example shows what a simple rackup (config.ru) file might look like:

require 'rack'
require 'rack/contrib'

use Rack::Profiler if ENV['RACK_ENV'] == 'development'

use Rack::ETag
use Rack::MailExceptions

run theapp

Links

rack-contrib on GitHub

<github.com/rack/rack-contrib>

Rack

<rack.rubyforge.org/>

Rack On GitHub

<github.org/rack/rack>

rack-devel mailing list

<groups.google.com/group/rack-devel>

Something went wrong with that request. Please try again.