Sha256: 29ec5573de2e456a58cae7e2417ec94338037ed27e3f38af8e72d98e4936c6cc

Contents?: true

Size: 646 Bytes

Versions: 56

Compression:

Stored size: 646 Bytes

Contents

require 'rack/utils'

class FlashSessionCookieMiddleware
  def initialize(app, session_key = '_session_id')
    @app = app
    @session_key = session_key
  end

  def call(env)
    if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/
      req = Rack::Request.new(env)
      env['HTTP_COOKIE'] = [ @session_key,
                             ::Rack::Utils.escape(req.params[@session_key]) ].
                           join('=').freeze unless req.params[@session_key].nil?
      env['HTTP_ACCEPT'] = "#{req.params['_http_accept']}".
                           freeze unless req.params['_http_accept'].nil?
    end
    @app.call(env)
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
wheels-0.1.30 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.28 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.27 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.25 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.24 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.23 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.22 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.21 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.20 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.19 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.18 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.17 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.16 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.15 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.14 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.13 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.12 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.11 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.10 lib/wheels/flash_session_cookie_middleware.rb
wheels-0.1.9 lib/wheels/flash_session_cookie_middleware.rb