Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
ESI middleware implementation for Rack. This middleware is currently reimplemented to run commands in parallel and fetch with curb.
Ruby
branch: master

Update README.md

best
Mr Typo
latest commit bff49e408d
@boof authored
Failed to load latest commit information.
lib Enumerable... respond_to :each... true.
test Updated README and added Gemfile.lock. Also did some spring cleaning.
.document Initial commit to rack-esi.
.gitignore
Gemfile Fixed usage of bundler and assign app in middleware, upsi.
Gemfile.lock Updated README and added Gemfile.lock. Also did some spring cleaning.
LICENSE Refactored core.
README.md Update README.md
Rakefile Refactored core.
rack-esi.gemspec

README.md

rack-esi

Rack-ESI is a Nokogiri based ESI middleware implementation for Rack with support for include tags, all other ESI namespaced nodes are just removed.

To make this gem work you must define the xmlns:esi namespace in your text/html response.

Note: This gem should only be used in development. For production use setup varnish or any other ESI enabled server.

Features

  • threaded (in case we have slow IOs)
  • PATH_INFO blacklisting (:skip => nil, should respond to ===)
  • support for esi|include[alt] and esi|include[noerror] fallbacks

Dependencies

  • Nokogiri
  • Rack

Setup

w/o Gemfile

$ gem install rack-esi

w/ Gemfile

gem 'rack-esi'

... and ...

$ bundle

rackup

use Rack::ESI, options || {}
run Application.new

Rails 2.3: environment.rb

... for setups w/o Gemfile

config.gem 'rack-esi'

... and ...

config.middleware.insert Rack::Lock, Rack::ESI

Rails 3.x: application.rb

config.middleware.insert ActionDispatch::Static, Rack::ESI

Rails 4.x: config/environments/development.rb

config.middleware.insert_before Rack::Lock, Rack::ESI

Options

  • poolsize: 4, Number of worker threads. A value of 1 disables threading model.
  • skip: nil, This should be an object which responds to #===(PATH_INFO).
  • parser: Nokogiri::XML::Document, You can change this to Nokogiri::HTML::Document, but you should change the serializer, too (see below).
  • serializer: :to_xhtml, The serializer value specifies the method name which is send to the object created by the parser#parse.

TODO

  • write documentation
  • write more tests
  • support more ESI elements

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it.
  • Commit, do not mess with rakefile, version, or history.
  • Send me a pull request.

Thanks

tenderlove and Qerub

Copyright

Copyright (c) 2011 Florian Aßmann. See LICENSE for details.

Something went wrong with that request. Please try again.