No commit activity in last 3 years
No release in over 3 years
A rack middleware library that allows for cookies to be passed through form parameters. Specifically, it merges the specified form parameters into the Cookie header of an http request. It gets around the problem of having a flash application which interacts with a web application that uses cookie based sessions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.0.0
 Project Readme

Rack Cookie Monster¶ ↑

A rack middleware library that allows for cookies to be passed through form parameters. Specifically, it merges the specified form parameters into the Cookie header of an http request. It gets around the problem of having a flash application which interacts with a web application that uses cookie based sessions.

Contributing¶ ↑

The environment can be configured by using bundler.

gem bundle or rake setup:contrib

Usage¶ ↑

Rails Example:

# In rails initializer
Rack::CookieMonster.configure do |c|
  c.eat :_session_id
  c.eat :user_credentials
  c.share_with /^(Adobe|Shockwave) Flash/
  c.share_with "Burt"
end

Rack::CookieMonster.configure_for_rails

Rack Example:

class CookieMonsterApplication
  def call(env)
    cookies = ::Rack::Request.new(env).cookies
    res = ::Rack::Response.new
    res.write %{
      <html>
        <head>
          <title>Form</title>
        </head>
        <body>
          <form action="/" method="post">
            Cookie 1: <input type="text" name="cookie_1" />
            Cookie 2: <input type="text" name="cookie_2" />
            Non Cookie: <input type="text" name="non_cookie" />
            <input type="submit" />
          </form>
        </body>
        #{
          cookies.map do |k,v|
            "<p>#{k} - #{v}</p>"
          end.join("\n")
        }
      </html>
    }
    res.finish
  end
end

use Rack::CookieMonster, {
  :cookies => [:cookie_1, :cookie_2],
  :share_with => /firefox/i
}
run CookieMonsterApplication.new